Subscribe to RSS Subscribe to Comments

mogri : network

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

Based on Fluidity©2006-2007 mogri.net | Theme Redesigned by Kaushal Sheth Sponsored by Web Hosting Bluebook