Hi friends
Can anybody here make a simple cursor which fetch one by one row of a table and call it from asp.net front page.
Cursor in sql server
3 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
Pankaj RanaRank #2,270 · 620 reputationPosted Dec 8, 2011, 4:11 AM EST
Declare @Lastname varchar(50)
DECLARE @Email varchar(20)
DECLARE Student_cursor CURSOR FOR
Select Firstname,Lastname,Email from student
OPEN Student_cursor;
FETCH NEXT FROM Student_cursor
INTO @Firstname, @Lastname, @Email;
WHILE @@FETCH_STATUS = 0
BEGIN
print '---------------'
print @Firstname
print @Lastname
print @Email
print '---------------'
FETCH NEXT FROM Student_cursor
INTO @ItemID;
END
CLOSE Student_cursor;
DEALLOCATE Student_cursor;
Refer this
http://queriesinsql.blogspot.com/2011/12/cursor-in-sql-with-example.html
Akshay TeotiaRank #603 · 4K reputationPosted Dec 9, 2011, 7:29 PM EST
Pankaj RanaRank #2,270 · 620 reputationPosted Dec 10, 2011, 12:00 AM EST