SQL Flow Field Guide

SET NOCOUNT

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

suppresses 'rows affected' messages; @@ROWCOUNT still updated

What changes

Input
none
Output or change
session state

Syntax at a glance

SET NOCOUNT { ON | OFF }

Work example

A stored procedure should avoid sending row-count messages that its caller does not use.

Test the client response with NOCOUNT on and off. Keep the setting inside the procedure when that is its intended scope.

Check your work SET NOCOUNT. The result sets remain unchanged and the client receives no unwanted row-count messages.

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