Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cursor syntax
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01340333
Message ID:
01340349
Views:
8
This message has been marked as the solution to the initial question of the thread.
>Borislav:
>
>That the problem, I need to create a select string that is build before the Cursor Statement is call, But the Declaration line does not allow use the @SQLStatement , so How I can execute the line after I build my statement.

I understand that, but I can't find a way HOW that cursor could be used after you create it?
DECLARE @sql varchar(2000)
SET @sql = "Select * From AOP_Financial Journal"

SET @sql = 'DECLARE  TempGregorio CURSOR FOR '+@sql
EXEC (@sql)

OPEN  TempGregorio 

-- do what you want to do with cursor

CLOSE TempGregorio 

DEALLOCATE TempGregorio 
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform