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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 running string/ variable concatenated query in a cursor

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-02-05 : 16:26:51
Paul13 writes "In my stored procedure, I build a querystring based on certain variables. I want to know how I can run that query string in a cursor.

what i tried is

@Qstr = "select " + @col1 + ", " + @col2 + " from tables1 where date = '01/20/2000'"

DECLARE tester CURSOR
FOR EXECUTE(@Qstr)

....


What i get when i try to create this stored procedure is a message saying I have an error in syntax near 'EXECUTE'. Can anyone tell me how I can run this QString in my cursor?

Paul13"
   

- Advertisement -