Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 when to set nocount on?

Author  Topic 

PeterG
Posting Yak Master

156 Posts

Posted - 2001-11-28 : 13:03:49
I've read a few articles on the importance of setting nocount on, but I'm not clear on WHEN to use it? I mean, what sorts of situations should I set nocount on and not off?

sica
Posting Yak Master

143 Posts

Posted - 2001-11-28 : 13:10:31
Use it when you dont't want network traffic...I always use it in my store procedure.

Sica

Go to Top of Page

royv
Constraint Violating Yak Guru

455 Posts

Posted - 2001-11-28 : 13:11:57
Well I use it in all my stored procedures. It reduces what gets sent to the output buffer. I guess it really depends on what you are doing. If you are debugging some code, you would probably not use it, so that you can see everything that is happening. The more I think about it, the answer really depends on what the situation is.

*************************
Just trying to get things done
Go to Top of Page

graz
Chief SQLTeam Crack Dealer

4149 Posts

Posted - 2001-11-28 : 13:13:30
The big problem with this is stored procedures in ASP pages. There may be others but that's the main one I've run across. If you have a stored procedure that runs a few statements such as updates or Select @var= you'll get a series of X records affected statements. It appears that these are affecting the ASP page's ability to see the record sets that are returned.

4Guys actually has a FAQ up on it right now: http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=174

===============================================
Creating tomorrow's legacy systems today.
One crisis at a time.
Go to Top of Page
   

- Advertisement -