Loading
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
Satyapriya NayakRank #47 · 31.5K reputationPosted Jul 16, 2012, 5:23 AM EDT
Cursors allow row-by-row processing of the result sets.
Types of cursors: Static, Dynamic, Forward-only, Keyset-driven.
Disadvantages of cursors: Each time you fetch a row from the cursor, it results in a network roundtrip, where as a normal SELECT query makes only one roundtrip , however large the resultset is. Cursors are also costly because they require more resources and temporary storage (results in more IO operations). Further, there are restrictions on the SELECT statements that can be used with some types of cursors.
Most of the times, set based operations can be used instead of cursors.
Please refer the below link for the example of Types of cursors
http://www.dotnet-tricks.com/Tutorial/sqlserver?id=RLID060512&title=SQL%20Server%20-%20Types%20of%20Cursors
Thanks
Jignesh TrivediRank #16 · 50.3K reputationPosted Jul 16, 2012, 7:44 PM EDT
A cursor is a set of rows together with a pointer that identifies a current row.
Simply when you want to perform Row by row Opration on SQL Table or query then you may use Cursor.
please refer
http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=%2Fcom.ibm.db2.udb.apdv.sql.doc%2Fdoc%2Fc0024361.htm
http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=%2Fcom.ibm.db2.udb.apdv.sql.doc%2Fdoc%2Fc0024361.htm
hope this will help you.
SenthilkumarRank #387 · 6.5K reputationPosted Jul 16, 2012, 10:24 PM EDT
when you have a requirement to iterate the sql server table or views to fetch the row by row then cursor needs to achieve this operation.