Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Declare cursor as a variable
Message
 
 
To
09/08/2005 12:42:19
Stephen Hunt
Admit Computer Services Inc.
Farmingdale, New York, United States
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01039571
Message ID:
01039591
Views:
23
DECLARE @sql varchar(8000)
SET @sql = 'DECLARE mycursor CURSOR FOR select * from filename'
EXEC (@sql)
>I am trying to build my select statement into a variable
>declare @query varchar(8000)
>set @query='select * from filename'
>when I try to execute my declare cursor
>declare cursor for @query
>I get an error 'incorrect syntax near @query'
>
>does SQL server allow for creating a cursor based on a select statement
>built into a variable ? and if so what am I doing wrong ?
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform