Home Dashboard Directory Help
Search

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


Status: 

Active


5
0
Sign in
to vote
Type: Suggestion
ID: 784980
Opened: 4/17/2013 9:39:06 PM
Access Restriction: Public
0
Workaround(s)
view

Description

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.
Details
Sign in to post a comment.
Posted by Microsoft on 4/19/2013 at 11:22 AM
Hello,
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!

http://connect.microsoft.com/SQLServer/feedback/details/404252/use-of-constants-in-sql
Sign in to post a workaround.