SQL Database Concepts Question:
Download Questions PDF

Tell me what are cursors and when they are useful?

Answer:

-When we execute any SQL operations, SQL Server opens a work area in memory which is called Cursor.

-When it is required to perform the row by row operations which are not possible with the set-based operations then Cursor is used.

-There are two of cursors

1. Implicate Cursor
SQL Server automatically manages cursors for all data manipulation statements. These cursors are called implicit cursors.

2. Explicit Cursor
When the programmer wants to perform the row by row operations for the result set containing more than one row, then he explicitly declare a cursor with a name.
They are managed by OPEN, FETCH and CLOSE.

%FOUND, %NOFOUND, %ROWCOUNT and %ISOPEN attributes are used in both types of cursors.

Download Basic SQL Server Interview Questions And Answers PDF

Previous QuestionNext Question
Explain the XML support SQL server extends?Can you explain what is SQL Server English Query?