Friday, December 23, 2005

Stephane Frechette : set nocount {on|off}: "set nocount {on|off}

How many times have I seen this?

You know what I'm talking about! - the 'set nocount {on|off}' statement.
Why do some developers just don't put it in there stored procedures...

It's certainly a must have that can provide a significant performance boost, it also reduces network traffic.

SQL BOL - (SQL Server Books Online):

“SET NOCOUNT ON eliminates the sending of DONE_IN_PROC messages to the client for each statement in a stored procedure. When using the utilities provided with Microsoft® SQL Server™ to execute queries, the results prevent 'nn rows affected' from being displayed at the end Transact-SQL statements such as SELECT, INSERT, UPDATE, and DELETE”

It takes a second and makes a difference in performance... believe me!!!

/sf"

0 Comments:

Post a Comment

<< Home