Pages

Saturday, 29 September 2012

What is use of "SET NOCOUNT" in SQL?

Ø  When SET NOCOUNT is ON, the count (indicating the number of rows affected by a Transact-SQL statement) is not returned. When SET NOCOUNT is OFF, the count is returned. It is used with any SELECT, INSERT, UPDATE, DELETE statement.
Ø  The setting of SET NOCOUNT is set at execute or run time and not at parse time.
Ø  SET NOCOUNT ON improves stored procedure (SP) performance.
Ø  Syntax: SET NOCOUNT { ON | OFF }

Example of SET NOCOUNT ON:









Example of SET NOCOUNT OFF:







1 comment:

  1. The "SET NOCOUNT" statement in SQL Server controls the message indicating the number of rows affected by a query. Card For Gaming Turning it ON suppresses these messages, reducing network traffic.

    ReplyDelete