---
title: "SQL Server: what will trigger execution plan?"  
description: "SQL Server: what will trigger execution plan?"  
author: "Pravesh Singh"  
published: 2013-05-08  
updated: 2013-05-08  
canonical: https://www.mindstick.com/forum/837/sql-server-what-will-trigger-execution-plan  
category: "mssql server"  
tags: ["mssql server"]  
reading_time: 1 minute  

---

# SQL Server: what will trigger execution plan?

Hi Everyone!\
If I have statement\
DECLARE @i [INT](https://www.mindstick.com/forum/159137/how-to-convert-date-int-to-date-in-sql);DECLARE @d NUMERIC(9,3);SET @i = 123;SET @d = @i;[SELECT](https://www.mindstick.com/forum/160534/orderby-then-select-vs-select-then-orderby-performance) @d;\
and I include actual [execution plan](https://www.mindstick.com/forum/160276/what-is-an-execution-plan-in-sql-server) and run this [query](https://www.mindstick.com/blog/202/sub-query-in-sqlserver), I don't get an execution plan. Will the query [trigger](https://www.mindstick.com/blog/167/triggers-in-wpf) execution plan only when there is FROM statement in the [batch](https://www.mindstick.com/forum/157604/explain-the-features-of-the-batch-operating-system-also-describe-the-pros-and-cons)?\
Thanks in [advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams)!

## Replies

### Reply by AVADHESH PATEL

Hi Pravesh!\
The simple answer is you don't get [execution](https://www.mindstick.com/blog/178/synchronous-and-asynchronous-command-execution-in-c-sharp-dot-net) plans without table access.\
Execution plans are what the optimiser produces: it work out the best way to satisfy the query based on indexes, statistics, etc.\
What you have above is trivial and has no table access. Why do you need a [plan](https://yourviews.mindstick.com/view/81331/decoding-israel-s-west-bank-addition-plan)?\
**Edit:**\
A derived table is table access as per Lucero's example in comments\
**Edit 2:**\
"Trivial" table access gives constant scans, not real scans or seeks:\
SELECT * FROM sys.tables WHERE 1=0Lucero's examples in comments\


---

Original Source: https://www.mindstick.com/forum/837/sql-server-what-will-trigger-execution-plan

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
