Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01451981
Message ID:
01451983
Views:
98
This message has been marked as the solution to the initial question of the thread.
You can use derived table. The execution plan most likely will be the same in both cases.
SELECT * FROM (  Select somefield+somethingelse as mycalcfield from mytable ) dt1
where mycalcfield>10
>In VFP you can do this
>
>Select somefield+somethingelse as mycalcfield from mytable where mycalcfield>10
>
>in T-SQL it seems you have to do this
>Select somefield+somethingelse as mycalcfield from mytable where somefield+somethingelse>10
>
>which means you have to maintain both calcfield expressions which is a maintenance headache
>
>Is there a way in T-SQL to use the calcfield alias in the where expression?
--sb--
Previous
Reply
Map
View