TSQL constants for coding and for better plans and faster execution! - by JRStern

Status : 

  Won't Fix<br /><br />
		Due to several factors the product team decided to focus its efforts on other items.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 784980 Comments
Status Closed Workarounds
Type Suggestion Repros 0
Opened 4/17/2013 9:39:06 PM
Access Restriction Public


I know this is a perennial, but I want to propose it yet again and present a brief argument why it is so useful.  I have spent the last couple of months going through code that uses a simple variable set to a value in where clauses, that produces horrible execution plans because SQL Server does not realize it is constant.  I have to add option(optimize) clauses to get good plans.  Being able to declare and use constants would improve code appearance, improve development processes, and produce better plans and better performance. 
Sign in to post a comment.
Posted by Microsoft on 4/19/2013 at 11:22 AM
After evaluating all of the suggestion items in our pipeline, we are closing items that we will not implement in the near future due to current higher priority items. We will re-evaluate the closed suggestions again in the future based on the product roadmap.

Thanks for your feedback.

Umachandar, SQL Programmability Team
Posted by JRStern on 4/18/2013 at 3:45 PM
On a cost/benefit basis, this has to be pretty near the top.
... and probably has been for 10 years and more. :)
Posted by SAinCA on 4/18/2013 at 10:49 AM
MS folks have closed 2 others as WON'T FIX(!) but did say to reopen if the need were still felt... IT IS!