Cursor (data type)
cursor variables and OUTPUT parameters
What changes
- Input
- none
- Output or change
- none
Syntax at a glance
DECLARE @cursor_variable CURSOR
Work example
Use a cursor only when a task must call an operation once per fetched row and a set-based statement cannot express it.
Review fetch status, close and deallocate paths, and whether the work can be rewritten as one statement.
Check your work A cursor is procedural state with cleanup needs, not a column type for ordinary table design.
Open Microsoft Learn for full syntax, permissions, and details for your version.