Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL View variables

Author  Topic 

Vack
Aged Yak Warrior

530 Posts

Posted - 2011-02-14 : 10:25:16
Can Variables be used in a SQL View?

RobertKaucher
Posting Yak Master

169 Posts

Posted - 2011-02-14 : 10:30:19
Nope. http://msdn.microsoft.com/en-us/library/aa258253(v=sql.80).aspx

quote:

There are a few restrictions on the SELECT clauses in a view definition. A CREATE VIEW statement cannot:

•Include COMPUTE or COMPUTE BY clauses.


•Include ORDER BY clause, unless there is also a TOP clause in the select list of the SELECT statement.


•Include the INTO keyword.


•Reference a temporary table or a table variable.




===
http://www.ElementalSQL.com/
Go to Top of Page

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2011-02-14 : 15:50:31
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=73034

See that topic for additional info and options.



Poor planning on your part does not constitute an emergency on my part.
Go to Top of Page
   

- Advertisement -