Solved

SET NOCOUNT ON - OFF - ON - OFF....

Posted on 2001-09-12
4
1,330 Views
Last Modified: 2007-12-19
Not really a question here...
Well, it is.

When i go to MSDN there is an article that states
that when you want to use a temporary table created by a stored procedure with ADO...
You should place SET NOCOUNT ON before any action is taken, they don't mention SET NOCOUNT OFF.

But then in SQL Books Online is stated that you
always should place SET NOCOUNT OFF after the handling...

What do these commands actually really do etc...
0
Comment
Question by:wvandeneede
4 Comments
 
LVL 1

Accepted Solution

by:
deestuar earned 10 total points
ID: 6476650
I normally do both for good practise if you don't do this you can get problems when retrieving data with record sets
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 6476670
I do actually only put it in front (SET NOCOUNT ON),
when my stored procedures are returning empty recordsets which are skipped that way when reading from VB+ADO.
When testing some scripts with some insert statments, i use it too, but for the rest i don't...
CHeers
0
 
LVL 6

Expert Comment

by:curtis591
ID: 6476830
Set nocount on stops the message indicating the number of rows affected by a sql statement from being returned.  If you go to query analyzer and run the statement you will not get the message 5 rows affected.  I have read a number of articles that claim that by setting nocount on in your procedures you can really get a performance boost but I have never really tested this theory.
0
 

Author Comment

by:wvandeneede
ID: 6482650
Since this wasn't really a question, i don't know
who to give the points to?

I hope everyone will be satisfied when i just give
them to the first reaction

measly little 10 points anyway ;)

CyA WeZ
0

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now