August 4th, 2007 • 08:08
SQL Cursor
DECLARE cursor CURSOR FOR {select statement...}
OPEN cursor
-- filling up the local variables from cursor
FETCH NEXT FROM cursor INTO @var1, @var2...
WHILE @@FETCH_STATUS = 0
BEGIN
{do your stuffs with variables}
END
CLOSE cursor
DEALLOCATE cursor
MSDN
Leave a Reply
No Comment
Be the first to respond!