Hi...
How can we define Cursor in SQL Server and how many type of cursor are use it?
Cursor in SQL Server
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Jan 13, 2012, 1:58 AM EST
http://www.c-sharpcorner.com/Forums/Thread/153980/cursors-in-sql.aspx
Ankit Shivnakr87 reputationPosted Jan 13, 2012, 1:59 AM EST
DECLARE @fName varchar(50), @lName varchar(50) DECLARE cursorName CURSOR -- Declare cursor LOCAL SCROLL STATIC FOR Select firstName, lastName FROM myTable OPEN cursorName -- open the cursor FETCH NEXT FROM cursorName INTO @fName, @lName PRINT @fName + ' ' + @lName -- print the name WHILE @@FETCH_STATUS = 0 BEGIN FETCH NEXT FROM cursorName INTO @fName, @lName PRINT @fName + ' ' + @lName -- print the name END CLOSE cursorName -- close the cursor DEALLOCATE cursorName -- Deallocate the cursor