General information
Forum:
Microsoft SQL Server
Title:
Declare cursor as a variable
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 ?
Thanks For Your Help !
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only