Simple Cursor Programme

Hi all,
Here is a simple sample for cursor.

declare testCur CURSOR For //Cursor declaring for

select top 10 * from tblUsers

Open testCur //Open the cursor

Fetch next from testCur //Fetch the first record

while @@FETCH_STATUS = 0

Fetch next from testCur //Fetch the next record while status = 0

CLOSE testCur //Close cursor

deallocate testCur //Deallocate the cursor.

...S.VinothkumaR.

No comments: