Quantcast
Channel: Forum SQL Server Database Engine
Viewing all articles
Browse latest Browse all 15889

Are there any negative affects with: SET NOCOUNT ON

$
0
0

http://technet.microsoft.com/en-us/library/ms189837.aspx

I wanted to ask if  anyone has experienced issues turning on (SET NOCOUNT)  in their environment.  

Plan would be to use it in stored procedures, or turn it on globally. (This would catch all the adhoc sql) ... select @@rowcount seems to be return the "count" if we needed to see the "count" results returned from updates/inserts/results.

Benefits seem positive.  I tried to look online for any issues. See comment below:


CAUTIONS/WARNINGS

Am I missing any more reported issues?
http://support.microsoft.com/kb/195491

So is this TRUE OR FALSE?

http://msdn.microsoft.com/en-us/library/33y2221y(VS.80).aspx        (.NET 2.0)

http://msdn.microsoft.com/en-us/library/33y2221y(v=vs.110).aspx   (.NET 4.5) 

SET <st1:place w:st="on"><st1:city w:st="on">NOCOUNT</st1:city> <st1:state w:st="on">ON</st1:state></st1:place> prevents returning @@rowcount value in SQL Adapter in .NET?If you are using SQL Server stored procedures to edit or delete data using a DataAdapter, make sure that you do not use SET <st1:place w:st="on"><st1:city w:st="on">NOCOUNT</st1:city> <st1:state w:st="on">ON</st1:state></st1:place> in the stored procedure definition. This causes the rows affected count returned to be zero, which the DataAdapter interprets as a concurrency conflict. In this event, a DBConcurrencyException will be thrown.


In SSMS it's fine(test below)....however is this true? - Microsoft states it is a problem.

-- Small Temp table
SET NOCOUNT ON
CREATE TABLE #Table
(
   ZipID INT IDENTITY(1,1),
   ZipCode CHAR(5)
)

-- Insert some ZipCodes
INSERT INTO #Table(ZipCode) 
VALUES('96826'),('96708'),('94112'),('95123')
SELECT @@rowcount as RowCountResult

Thanks everyone,
-Norm



Viewing all articles
Browse latest Browse all 15889

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>