SQL Flow Field Guide

@@CURSOR_ROWS

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

cursor state

What changes

Input
last opened cursor
Output or change
row count
Return type
int

Syntax at a glance

@@CURSOR_ROWS

Work example

Inspect how many rows an existing cursor reports in its result set.

Test empty, one-row, and multi-row results. Read fetch status immediately and verify cleanup paths.

Check your work Cursor type affects this value, so compare it with fetch status and declared options.

Open Microsoft Learn for full syntax, permissions, and details for your version.