Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
For... Next for SQL
Message
From
16/07/2004 04:05:30
 
 
To
13/07/2004 19:26:23
Ricardo Giron
Secrex Compañía de Seguros de Crédito
Lima, Peru
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00924012
Message ID:
00925060
Views:
17
>Hi!
>
>How can I implement a For... Next in SQL?
>
>Thanks


DECLARE myCursor CURSOR FOR SELECT {your select statement}

OPEN myCursor

FETCH NEXT FROM myCursor INTO @myVar1, @myVar2,...
WHILE @@FETCH_STATUS = 0
BEGIN
{do something here}
FETCH NEXT FROM myCursor INTO @myVar1, @myVar2,...
END
CLOSE myCursor
DEALLOCATE myCursor
Previous
Reply
Map
View

Click here to load this message in the networking platform