SQL Server 2025 Cursors: Final Self-Check: Answers
Objective: Explain the correct choices.
Compare these explanations with your own choices. Each question has one best answer.
1. Which operation returns the first row after OPEN?
B. FETCH NEXT
OPEN prepares execution. The initial FETCH NEXT retrieves the first qualifying row.
2. Which option supports ABSOLUTE navigation?
B. LOCAL SCROLL STATIC READ_ONLY
The STATIC SCROLL example supports absolute positions. FAST_FORWARD allows NEXT only; DYNAMIC does not support ABSOLUTE.
3. What should you try first for updating every matching row?
A. One set-based UPDATE
Updating several matching rows does not itself require a cursor. Express the matching rule in SQL first.
4. What does CLOSE retain?
B. The cursor structures needed for reopening
CLOSE releases the current result. FETCH requires reopening, and transaction completion is separate.
5. When are cursor structures freed by DEALLOCATE?
B. When the last reference is removed
A name and a variable can reference the same cursor. The remaining reference can keep it alive.
6. When should @@FETCH_STATUS be checked?
B. Immediately after the FETCH being evaluated
It reflects the last fetch on the connection; another cursor fetch can overwrite the status.
7. What is fixed in a fully populated keyset?
B. Key membership and ordering
Existing member values can change, subject to visibility rules. Missing members can produce a -2 fetch status.