SET ROWCOUNT
stops processing after N rows for following statements; acts like an implicit TOP
What changes
- Input
- none
- Output or change
- session state
Syntax at a glance
SET ROWCOUNT { number | @number_var }
Work example
A session workflow needs the specific behavior of SET ROWCOUNT for a bounded operation.
Record the starting session state, set the option only for the operation, and restore the documented default before returning a pooled connection.
Check your work SET ROWCOUNT. The operation follows the intended SET ROWCOUNT behavior and the next task sees the expected session state.
Open Microsoft Learn for full syntax, permissions, and details for your version.