Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Should I and why ? set nocount on

Status
Not open for further replies.

spDavCom

Programmer
Feb 16, 2003
13
US
QUESTION:

Should I include the SET NOCOUNT ON statement in my stored procedures? What's the correct syntax?

NOTE:
I've head that this increase network performance. And, all of my stored procs are called from asp.net pages.

Thanks. Any input or syntax is much appreciated.
 
SET NOCOUNT ON simply inhibits the Rows Affected messages returned by SQL Server when a SELECT, UPDATE, INSERT or DELETE query is runs. There are informational messages only and usually not required by the client program. Inhibiting the messages will reduce network traffic slightly. It usually good procedure to inhibit these messages so the client code doesn't have to deal with them. If you want to get the best answer for your question read faq183-874 and thread183-468158.
Terry L. Broadbent - DBA
SQL Server Page:
 
As for your question about correct syntax, it's just SET NOCOUNT ON.

example:

SET NOCOUNT ON
SELECT c1, c2
FROM mytable

-SQLBill
 
Thank you sqlBill, it seems to shave off a few seconds.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top