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)
 Run-time queries in Stored Procedures

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-11-08 : 10:32:20
Abhijit writes "Hi,

I would like to build queries at run time and build a cursor using this build queries.
Is it possible with SQL Server 7.0 or SQL Server 2000.

I would like to do something like this

Declare @sSql nvarchar(50)
select @sSql = ''

select @sSql = 'Select * From Table1'

Declare Temp_cursor CURSOR for @sSql
open Days_cursor
FETCH NEXT FROM Days_cursor into @DaysInYear,@UserId


Regards,
Abhijit."
   

- Advertisement -