<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; Effect of SET NOCOUNT on @@ROWCOUNT</title>
	<atom:link href="http://blog.sqlauthority.com/2011/12/02/sql-server-effect-of-set-no-count-on-rowcount/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2011/12/02/sql-server-effect-of-set-no-count-on-rowcount/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Thu, 23 May 2013 14:22:59 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: innobits</title>
		<link>http://blog.sqlauthority.com/2011/12/02/sql-server-effect-of-set-no-count-on-rowcount/#comment-473362</link>
		<dc:creator><![CDATA[innobits]]></dc:creator>
		<pubDate>Sat, 11 May 2013 17:22:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=16112#comment-473362</guid>
		<description><![CDATA[Sir, I have found the following error while working in ASP page.
ADODB.Recordseterror &#039;800a0e78&#039;

Operation is not allowed when the object is closed.

But when I have added SET NOCOUNT ON it is sorted out.
How this is linked in. Kindly clarify my doubt.]]></description>
		<content:encoded><![CDATA[<p>Sir, I have found the following error while working in ASP page.<br />
ADODB.Recordseterror &#8217;800a0e78&#8242;</p>
<p>Operation is not allowed when the object is closed.</p>
<p>But when I have added SET NOCOUNT ON it is sorted out.<br />
How this is linked in. Kindly clarify my doubt.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vinay</title>
		<link>http://blog.sqlauthority.com/2011/12/02/sql-server-effect-of-set-no-count-on-rowcount/#comment-391097</link>
		<dc:creator><![CDATA[Vinay]]></dc:creator>
		<pubDate>Tue, 11 Dec 2012 07:19:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=16112#comment-391097</guid>
		<description><![CDATA[DECLARE @table TABLE(col1 INT IDENTITY(1,1), col2 INT)
INSERT INTO @table(col2) VALUES (2932)
SET NOCOUNT ON           
SELECT * FROM @table
SELECT @@rowcount
SET NOCOUNT OFF

Result :1 2932
            1

DECLARE @table TABLE(col1 INT IDENTITY(1,1), col2 INT)
INSERT INTO @table(col2) VALUES (2932)
SELECT * FROM @table
SET NOCOUNT ON
SELECT @@rowcount
SET NOCOUNT OFF

Result :1 2932
            0
In above statements, i changed SET NOCOUNT ON  position then its showing different Outputs.

Nice Example............]]></description>
		<content:encoded><![CDATA[<p>DECLARE @table TABLE(col1 INT IDENTITY(1,1), col2 INT)<br />
INSERT INTO @table(col2) VALUES (2932)<br />
SET NOCOUNT ON<br />
SELECT * FROM @table<br />
SELECT @@rowcount<br />
SET NOCOUNT OFF</p>
<p>Result :1 2932<br />
            1</p>
<p>DECLARE @table TABLE(col1 INT IDENTITY(1,1), col2 INT)<br />
INSERT INTO @table(col2) VALUES (2932)<br />
SELECT * FROM @table<br />
SET NOCOUNT ON<br />
SELECT @@rowcount<br />
SET NOCOUNT OFF</p>
<p>Result :1 2932<br />
            0<br />
In above statements, i changed SET NOCOUNT ON  position then its showing different Outputs.</p>
<p>Nice Example&#8230;&#8230;&#8230;&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #006 &#171; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2011/12/02/sql-server-effect-of-set-no-count-on-rowcount/#comment-389250</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #006 &#171; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Sat, 08 Dec 2012 01:31:25 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=16112#comment-389250</guid>
		<description><![CDATA[[...] Effect of SET NOCOUNT on @@ROWCOUNT There was an interesting incident once while I was presenting a session. I wrote a code and suddenly 10 hands went up in the air.  This was a bit surprise to me as I do not know why they all got alerted. I assumed that there should be something wrong with either project, screen or my display. However the real reason was very interesting &#8211; I suggest you read the complete blog post to understand this interesting scenario. [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Effect of SET NOCOUNT on @@ROWCOUNT There was an interesting incident once while I was presenting a session. I wrote a code and suddenly 10 hands went up in the air.  This was a bit surprise to me as I do not know why they all got alerted. I assumed that there should be something wrong with either project, screen or my display. However the real reason was very interesting &#8211; I suggest you read the complete blog post to understand this interesting scenario. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mansoor ahmed</title>
		<link>http://blog.sqlauthority.com/2011/12/02/sql-server-effect-of-set-no-count-on-rowcount/#comment-388202</link>
		<dc:creator><![CDATA[mansoor ahmed]]></dc:creator>
		<pubDate>Thu, 06 Dec 2012 16:20:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=16112#comment-388202</guid>
		<description><![CDATA[I want to Make a Visitor Counter for my Publishers.
for example:
I have 150+ premium users who have 3 ads of each and everyone...
i want to count all users ads view with trace IP and Store in one table in database....
i can count by session but it works only on Session... if Session reset then it&#039;s counting must be reset....
I want to count continuously...Kindly Help Me]]></description>
		<content:encoded><![CDATA[<p>I want to Make a Visitor Counter for my Publishers.<br />
for example:<br />
I have 150+ premium users who have 3 ads of each and everyone&#8230;<br />
i want to count all users ads view with trace IP and Store in one table in database&#8230;.<br />
i can count by session but it works only on Session&#8230; if Session reset then it&#8217;s counting must be reset&#8230;.<br />
I want to count continuously&#8230;Kindly Help Me</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Dimmick</title>
		<link>http://blog.sqlauthority.com/2011/12/02/sql-server-effect-of-set-no-count-on-rowcount/#comment-381993</link>
		<dc:creator><![CDATA[Mike Dimmick]]></dc:creator>
		<pubDate>Tue, 27 Nov 2012 12:14:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=16112#comment-381993</guid>
		<description><![CDATA[Don Schaeffer: The point is that ANY statement, anything at all, always resets @@ROWCOUNT. If you need the result of @@ROWCOUNT you *must* use it *immediately* after the query you need to count. If you need to do any conditional logic, you must assign @@ROWCOUNT to another variable.

The same is true of @@ERROR, which is why TRY ... CATCH is such a useful addition.

Nighil: Yes, because the script queries the @@ROWCOUNT variable immediately after the &#039;SELECT * FROM table&#039;, it will always return 4. It doesn&#039;t matter whether NOCOUNT is ON or OFF. NOCOUNT merely controls whether the count is *directly* returned to the client (e.g. sqlcmd or Management Studio will output &#039;(4 row(s) affected.)&#039;) or not (nothing is output).

This information isn&#039;t usually all that useful, it just wastes network bandwidth (and potentially could make SQL Server have to block, waiting for the client to consume the message, if the client&#039;s network buffer is full) so it&#039;s common to SET NOCOUNT ON. (OFF is the default.) It&#039;s used by some frameworks to detect conflicts, for example if you want to ensure that the values of a row you&#039;re updating haven&#039;t changed since you read them, you might write:

UPDATE table
SET col2 = 4526
WHERE col1 = 2 AND col2 = 142

If the row hasn&#039;t changed, the update will find one row and therefore return &#039;1 row affected&#039;. If it *has* changed, col2 will not match and it will return &#039;0 rows affected&#039;, therefore you know that there was a conflict.

If instead the code was:

SELECT * FROM table
SET NOCOUNT ON -- or SET NOCOUNT OFF, or PRINT &#039;Hi!&#039;
SELECT @@ROWCOUNT

then you&#039;d get 0, rather than 4. The fact that you&#039;re modifying the NOCOUNT option is a total red herring; the two are not related.]]></description>
		<content:encoded><![CDATA[<p>Don Schaeffer: The point is that ANY statement, anything at all, always resets @@ROWCOUNT. If you need the result of @@ROWCOUNT you *must* use it *immediately* after the query you need to count. If you need to do any conditional logic, you must assign @@ROWCOUNT to another variable.</p>
<p>The same is true of @@ERROR, which is why TRY &#8230; CATCH is such a useful addition.</p>
<p>Nighil: Yes, because the script queries the @@ROWCOUNT variable immediately after the &#8216;SELECT * FROM table&#8217;, it will always return 4. It doesn&#8217;t matter whether NOCOUNT is ON or OFF. NOCOUNT merely controls whether the count is *directly* returned to the client (e.g. sqlcmd or Management Studio will output &#8216;(4 row(s) affected.)&#8217;) or not (nothing is output).</p>
<p>This information isn&#8217;t usually all that useful, it just wastes network bandwidth (and potentially could make SQL Server have to block, waiting for the client to consume the message, if the client&#8217;s network buffer is full) so it&#8217;s common to SET NOCOUNT ON. (OFF is the default.) It&#8217;s used by some frameworks to detect conflicts, for example if you want to ensure that the values of a row you&#8217;re updating haven&#8217;t changed since you read them, you might write:</p>
<p>UPDATE table<br />
SET col2 = 4526<br />
WHERE col1 = 2 AND col2 = 142</p>
<p>If the row hasn&#8217;t changed, the update will find one row and therefore return &#8217;1 row affected&#8217;. If it *has* changed, col2 will not match and it will return &#8217;0 rows affected&#8217;, therefore you know that there was a conflict.</p>
<p>If instead the code was:</p>
<p>SELECT * FROM table<br />
SET NOCOUNT ON &#8212; or SET NOCOUNT OFF, or PRINT &#8216;Hi!&#8217;<br />
SELECT @@ROWCOUNT</p>
<p>then you&#8217;d get 0, rather than 4. The fact that you&#8217;re modifying the NOCOUNT option is a total red herring; the two are not related.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Don Schaeffer</title>
		<link>http://blog.sqlauthority.com/2011/12/02/sql-server-effect-of-set-no-count-on-rowcount/#comment-378268</link>
		<dc:creator><![CDATA[Don Schaeffer]]></dc:creator>
		<pubDate>Wed, 21 Nov 2012 20:42:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=16112#comment-378268</guid>
		<description><![CDATA[I found that an if statement can reset @@rowcount:.  The following always returns zero, regardless of any previous selects.

IF @debug = 1 SELECT @@rowcount]]></description>
		<content:encoded><![CDATA[<p>I found that an if statement can reset @@rowcount:.  The following always returns zero, regardless of any previous selects.</p>
<p>IF @debug = 1 SELECT @@rowcount</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nighil</title>
		<link>http://blog.sqlauthority.com/2011/12/02/sql-server-effect-of-set-no-count-on-rowcount/#comment-369426</link>
		<dc:creator><![CDATA[Nighil]]></dc:creator>
		<pubDate>Mon, 05 Nov 2012 05:04:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=16112#comment-369426</guid>
		<description><![CDATA[check the below code i am setting nocount as off still getting rowcount as 4

DECLARE @table TABLE(col1 INT IDENTITY(1,1), col2 INT)
INSERT INTO @table(col2) VALUES (2932),(142),(352),(342)
SET NOCOUNT OFF
SELECT * FROM @table
SELECT @@rowcount
SET NOCOUNT OFF]]></description>
		<content:encoded><![CDATA[<p>check the below code i am setting nocount as off still getting rowcount as 4</p>
<p>DECLARE @table TABLE(col1 INT IDENTITY(1,1), col2 INT)<br />
INSERT INTO @table(col2) VALUES (2932),(142),(352),(342)<br />
SET NOCOUNT OFF<br />
SELECT * FROM @table<br />
SELECT @@rowcount<br />
SET NOCOUNT OFF</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bhasker reddy</title>
		<link>http://blog.sqlauthority.com/2011/12/02/sql-server-effect-of-set-no-count-on-rowcount/#comment-339466</link>
		<dc:creator><![CDATA[bhasker reddy]]></dc:creator>
		<pubDate>Fri, 31 Aug 2012 05:51:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=16112#comment-339466</guid>
		<description><![CDATA[Yes u r absolutely right...............]]></description>
		<content:encoded><![CDATA[<p>Yes u r absolutely right&#8230;&#8230;&#8230;&#8230;&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: prabha</title>
		<link>http://blog.sqlauthority.com/2011/12/02/sql-server-effect-of-set-no-count-on-rowcount/#comment-300329</link>
		<dc:creator><![CDATA[prabha]]></dc:creator>
		<pubDate>Tue, 12 Jun 2012 10:20:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=16112#comment-300329</guid>
		<description><![CDATA[good its very userful]]></description>
		<content:encoded><![CDATA[<p>good its very userful</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stanley david</title>
		<link>http://blog.sqlauthority.com/2011/12/02/sql-server-effect-of-set-no-count-on-rowcount/#comment-282942</link>
		<dc:creator><![CDATA[stanley david]]></dc:creator>
		<pubDate>Tue, 08 May 2012 13:20:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=16112#comment-282942</guid>
		<description><![CDATA[i am a beginner in ms sql... can u pls explian the concept of nocount on,,,if possible can u simplify your answer..]]></description>
		<content:encoded><![CDATA[<p>i am a beginner in ms sql&#8230; can u pls explian the concept of nocount on,,,if possible can u simplify your answer..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patibandla</title>
		<link>http://blog.sqlauthority.com/2011/12/02/sql-server-effect-of-set-no-count-on-rowcount/#comment-274636</link>
		<dc:creator><![CDATA[Patibandla]]></dc:creator>
		<pubDate>Tue, 10 Apr 2012 07:21:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=16112#comment-274636</guid>
		<description><![CDATA[Exactly, this should be the Understanding.]]></description>
		<content:encoded><![CDATA[<p>Exactly, this should be the Understanding.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ashish Kadam</title>
		<link>http://blog.sqlauthority.com/2011/12/02/sql-server-effect-of-set-no-count-on-rowcount/#comment-214470</link>
		<dc:creator><![CDATA[Ashish Kadam]]></dc:creator>
		<pubDate>Sat, 10 Dec 2011 07:28:54 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=16112#comment-214470</guid>
		<description><![CDATA[Hi Vinay,
i have one more solution for you, which i think very easy to implement.
Please see this, it may helps to you.

SET NOCOUNT ON
DECLARE @table TABLE(col1 INT IDENTITY(1,1), ID INT, Name Varchar(50))
INSERT INTO @table(Name,ID) 
VALUES (&#039;Pramod&#039;,1111),(&#039;Sushil&#039;, 1234),(&#039;Ashish&#039;,2345),(&#039;Prakash&#039;,4563),(&#039;Anil&#039;,1111), (&#039;Akash&#039;,4563)

-- Table For Results
DECLARE @table2 TABLE(col1 INT IDENTITY(1,1), ID INT, Name Varchar(150))

-- Variable Declaration
Declare @Cnt As Int=0
Declare @RowID As Int=0
Declare @RowName As Varchar(50)=NULL

Declare @RowFirst As Int=1
Declare @RowCount As Int=0
SELECT Top 1 @RowCount=Col1 FROM @table Order By col1 Desc

While (@RowFirst=1)
		Begin
			Update @table2 Set Name=Name+&#039;, &#039;+@RowName Where ID=@RowID  
		End
		Else
		Begin
			Insert Into @table2(ID,Name) Values(@RowID,@RowName)  		
		End		  
	End	
	
	Set @RowFirst=@RowFirst+1	    
End
Set NOCOunt OFF

Select * From @table2 

Thanks.]]></description>
		<content:encoded><![CDATA[<p>Hi Vinay,<br />
i have one more solution for you, which i think very easy to implement.<br />
Please see this, it may helps to you.</p>
<p>SET NOCOUNT ON<br />
DECLARE @table TABLE(col1 INT IDENTITY(1,1), ID INT, Name Varchar(50))<br />
INSERT INTO @table(Name,ID)<br />
VALUES (&#8216;Pramod&#8217;,1111),(&#8216;Sushil&#8217;, 1234),(&#8216;Ashish&#8217;,2345),(&#8216;Prakash&#8217;,4563),(&#8216;Anil&#8217;,1111), (&#8216;Akash&#8217;,4563)</p>
<p>&#8211; Table For Results<br />
DECLARE @table2 TABLE(col1 INT IDENTITY(1,1), ID INT, Name Varchar(150))</p>
<p>&#8211; Variable Declaration<br />
Declare @Cnt As Int=0<br />
Declare @RowID As Int=0<br />
Declare @RowName As Varchar(50)=NULL</p>
<p>Declare @RowFirst As Int=1<br />
Declare @RowCount As Int=0<br />
SELECT Top 1 @RowCount=Col1 FROM @table Order By col1 Desc</p>
<p>While (@RowFirst=1)<br />
		Begin<br />
			Update @table2 Set Name=Name+&#8217;, &#8216;+@RowName Where ID=@RowID<br />
		End<br />
		Else<br />
		Begin<br />
			Insert Into @table2(ID,Name) Values(@RowID,@RowName)<br />
		End<br />
	End	</p>
<p>	Set @RowFirst=@RowFirst+1<br />
End<br />
Set NOCOunt OFF</p>
<p>Select * From @table2 </p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vinay B Hiraskar</title>
		<link>http://blog.sqlauthority.com/2011/12/02/sql-server-effect-of-set-no-count-on-rowcount/#comment-213875</link>
		<dc:creator><![CDATA[Vinay B Hiraskar]]></dc:creator>
		<pubDate>Fri, 09 Dec 2011 05:03:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=16112#comment-213875</guid>
		<description><![CDATA[Thanks Narendra!!!! 
I will look over i think it will solve my problem.]]></description>
		<content:encoded><![CDATA[<p>Thanks Narendra!!!!<br />
I will look over i think it will solve my problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Narendra</title>
		<link>http://blog.sqlauthority.com/2011/12/02/sql-server-effect-of-set-no-count-on-rowcount/#comment-213349</link>
		<dc:creator><![CDATA[Narendra]]></dc:creator>
		<pubDate>Thu, 08 Dec 2011 09:59:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=16112#comment-213349</guid>
		<description><![CDATA[Hi Vinay,

i have one solution for your problem, but it is some what lengthy process i feel . i always remembering one proverb &quot;Something is better than Nothing&quot;.
Based on that proverb, i developed the following code. Please see this, it may helps to you.

--Copy Of the Original TestSeries Table For Distinct [KEY] values
CREATE TABLE #TestSeries ([KEY] INT)
INSERT INTO #TestSeries 
SELECT DISTINCT [KEY] FROM TestSeries

-- Table For Results
CREATE TABLE #TestSeriesResult (NAME VARCHAR(250),[KEY] INT)

--Declaring Parameters
DECLARE @RowCount INT,
		@RowStart INT,
		@listStr VARCHAR(20),
		@Value INT
		 
SET @RowStart = 1
SELECT @RowCount = COUNT(DISTINCT [KEY]) FROM #TestSeries

WHILE (@RowStart &lt;= @RowCount)
BEGIN
	 SET @Value = (SELECT TOP 1 [KEY] FROM #TestSeries)
	 SELECT @listStr = COALESCE(@listStr+&#039;,&#039; ,&#039;&#039;) + Name FROM TestSeries WHERE [KEY] = @Value
	 INSERT INTO #TestSeriesResult (NAME,[KEY])
	 SELECT @listStr,@Value
	 DELETE FROM #TestSeries WHERE [KEY] = @Value
	 SET @RowStart = @RowStart + 1
	 SET @listStr = &#039;&#039;
END
SELECT CASE WHEN (CHARINDEX(&#039;,&#039;,NAME,0) ) = 1
			THEN SUBSTRING(NAME,CHARINDEX(&#039;,&#039;,NAME,0)+1,LEN(NAME))
			ELSE NAME 
	   END AS NAME,
	   [KEY]
FROM #TestSeriesResult]]></description>
		<content:encoded><![CDATA[<p>Hi Vinay,</p>
<p>i have one solution for your problem, but it is some what lengthy process i feel . i always remembering one proverb &#8220;Something is better than Nothing&#8221;.<br />
Based on that proverb, i developed the following code. Please see this, it may helps to you.</p>
<p>&#8211;Copy Of the Original TestSeries Table For Distinct [KEY] values<br />
CREATE TABLE #TestSeries ([KEY] INT)<br />
INSERT INTO #TestSeries<br />
SELECT DISTINCT [KEY] FROM TestSeries</p>
<p>&#8211; Table For Results<br />
CREATE TABLE #TestSeriesResult (NAME VARCHAR(250),[KEY] INT)</p>
<p>&#8211;Declaring Parameters<br />
DECLARE @RowCount INT,<br />
		@RowStart INT,<br />
		@listStr VARCHAR(20),<br />
		@Value INT</p>
<p>SET @RowStart = 1<br />
SELECT @RowCount = COUNT(DISTINCT [KEY]) FROM #TestSeries</p>
<p>WHILE (@RowStart &lt;= @RowCount)<br />
BEGIN<br />
	 SET @Value = (SELECT TOP 1 [KEY] FROM #TestSeries)<br />
	 SELECT @listStr = COALESCE(@listStr+&#039;,&#039; ,&#039;&#039;) + Name FROM TestSeries WHERE [KEY] = @Value<br />
	 INSERT INTO #TestSeriesResult (NAME,[KEY])<br />
	 SELECT @listStr,@Value<br />
	 DELETE FROM #TestSeries WHERE [KEY] = @Value<br />
	 SET @RowStart = @RowStart + 1<br />
	 SET @listStr = &#039;&#039;<br />
END<br />
SELECT CASE WHEN (CHARINDEX(&#039;,&#039;,NAME,0) ) = 1<br />
			THEN SUBSTRING(NAME,CHARINDEX(&#039;,&#039;,NAME,0)+1,LEN(NAME))<br />
			ELSE NAME<br />
	   END AS NAME,<br />
	   [KEY]<br />
FROM #TestSeriesResult</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nilla (@Sg_nilaa)</title>
		<link>http://blog.sqlauthority.com/2011/12/02/sql-server-effect-of-set-no-count-on-rowcount/#comment-212517</link>
		<dc:creator><![CDATA[Nilla (@Sg_nilaa)]]></dc:creator>
		<pubDate>Wed, 07 Dec 2011 04:46:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=16112#comment-212517</guid>
		<description><![CDATA[Yes, you are correct.]]></description>
		<content:encoded><![CDATA[<p>Yes, you are correct.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vinay B Hiraskar</title>
		<link>http://blog.sqlauthority.com/2011/12/02/sql-server-effect-of-set-no-count-on-rowcount/#comment-211353</link>
		<dc:creator><![CDATA[Vinay B Hiraskar]]></dc:creator>
		<pubDate>Mon, 05 Dec 2011 13:34:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=16112#comment-211353</guid>
		<description><![CDATA[Hi Pinal Sir,
I am having a table called Test consists of Two column Name and Key Fields;
(Pramod,1111),(Sushil 1234),(Ashish,2345),(Prakash,4563),(Anil,1111), (Akash,4563) names and Key are followed Respectively.

Is There any query which will group a common value field member and results as follows when i Execute a&#039; Select name, key from Test&#039; Statement:
Pramod,Anil(Since it&#039;s Value Member are Same)
Sushil
Ashish
Prakash,Akash(Since it&#039;s Value Member are Same)


Thank in Advance Sir!!]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal Sir,<br />
I am having a table called Test consists of Two column Name and Key Fields;<br />
(Pramod,1111),(Sushil 1234),(Ashish,2345),(Prakash,4563),(Anil,1111), (Akash,4563) names and Key are followed Respectively.</p>
<p>Is There any query which will group a common value field member and results as follows when i Execute a&#8217; Select name, key from Test&#8217; Statement:<br />
Pramod,Anil(Since it&#8217;s Value Member are Same)<br />
Sushil<br />
Ashish<br />
Prakash,Akash(Since it&#8217;s Value Member are Same)</p>
<p>Thank in Advance Sir!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nakul Vachhrajani</title>
		<link>http://blog.sqlauthority.com/2011/12/02/sql-server-effect-of-set-no-count-on-rowcount/#comment-210662</link>
		<dc:creator><![CDATA[Nakul Vachhrajani]]></dc:creator>
		<pubDate>Sun, 04 Dec 2011 14:06:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=16112#comment-210662</guid>
		<description><![CDATA[I have been working with SQL Server for about 7 years now, and I will confess that in my first year, I too believed in this myth. Then, I had to develop a code that used the count returned by @@ROWCOUNT and that busted the myth for me.

Thank-you for sharing your experience, and also in ensuring that one more myth now lies busted!]]></description>
		<content:encoded><![CDATA[<p>I have been working with SQL Server for about 7 years now, and I will confess that in my first year, I too believed in this myth. Then, I had to develop a code that used the count returned by @@ROWCOUNT and that busted the myth for me.</p>
<p>Thank-you for sharing your experience, and also in ensuring that one more myth now lies busted!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ashish Jain</title>
		<link>http://blog.sqlauthority.com/2011/12/02/sql-server-effect-of-set-no-count-on-rowcount/#comment-209487</link>
		<dc:creator><![CDATA[Ashish Jain]]></dc:creator>
		<pubDate>Fri, 02 Dec 2011 16:59:11 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=16112#comment-209487</guid>
		<description><![CDATA[I think below script will help to test 

DECLARE @table TABLE(col1 INT IDENTITY(1,1), col2 INT)
INSERT INTO @table(col2) VALUES (2932),(142),(352),(342),(352),(342)
INSERT INTO @table(col2) VALUES (355),(344)
SET NOCOUNT ON
SELECT * FROM @table
SELECT @@rowcount
SET NOCOUNT OFF]]></description>
		<content:encoded><![CDATA[<p>I think below script will help to test </p>
<p>DECLARE @table TABLE(col1 INT IDENTITY(1,1), col2 INT)<br />
INSERT INTO @table(col2) VALUES (2932),(142),(352),(342),(352),(342)<br />
INSERT INTO @table(col2) VALUES (355),(344)<br />
SET NOCOUNT ON<br />
SELECT * FROM @table<br />
SELECT @@rowcount<br />
SET NOCOUNT OFF</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ashish Jain</title>
		<link>http://blog.sqlauthority.com/2011/12/02/sql-server-effect-of-set-no-count-on-rowcount/#comment-209469</link>
		<dc:creator><![CDATA[Ashish Jain]]></dc:creator>
		<pubDate>Fri, 02 Dec 2011 16:43:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=16112#comment-209469</guid>
		<description><![CDATA[Pinal Sir,
         I think that if we use Insert, Update or delete statements just before @@rowcount, it gives number of rows affected by the just previous statement. When we use select statement just before @@rowcount, it gives number of rows retrieved by select statement.
         Set NOCOUNT statement stops the &quot;rows affected&quot; messages coming on message screen. It will have no effect on @@rocount functionality.


Thanks]]></description>
		<content:encoded><![CDATA[<p>Pinal Sir,<br />
         I think that if we use Insert, Update or delete statements just before @@rowcount, it gives number of rows affected by the just previous statement. When we use select statement just before @@rowcount, it gives number of rows retrieved by select statement.<br />
         Set NOCOUNT statement stops the &#8220;rows affected&#8221; messages coming on message screen. It will have no effect on @@rocount functionality.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ramdas</title>
		<link>http://blog.sqlauthority.com/2011/12/02/sql-server-effect-of-set-no-count-on-rowcount/#comment-209399</link>
		<dc:creator><![CDATA[Ramdas]]></dc:creator>
		<pubDate>Fri, 02 Dec 2011 14:16:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=16112#comment-209399</guid>
		<description><![CDATA[good article and nice explanation by david.]]></description>
		<content:encoded><![CDATA[<p>good article and nice explanation by david.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mohit Pandit</title>
		<link>http://blog.sqlauthority.com/2011/12/02/sql-server-effect-of-set-no-count-on-rowcount/#comment-209339</link>
		<dc:creator><![CDATA[Mohit Pandit]]></dc:creator>
		<pubDate>Fri, 02 Dec 2011 12:21:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=16112#comment-209339</guid>
		<description><![CDATA[Hi David,

Pretty much agree with you.

Best Regards,
Mohit Pandit]]></description>
		<content:encoded><![CDATA[<p>Hi David,</p>
<p>Pretty much agree with you.</p>
<p>Best Regards,<br />
Mohit Pandit</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mohit Pandit</title>
		<link>http://blog.sqlauthority.com/2011/12/02/sql-server-effect-of-set-no-count-on-rowcount/#comment-209336</link>
		<dc:creator><![CDATA[Mohit Pandit]]></dc:creator>
		<pubDate>Fri, 02 Dec 2011 12:18:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=16112#comment-209336</guid>
		<description><![CDATA[Kindly concentrate about what is Pinal wanted to emphasis... don&#039;t mind; you can find out order here.

DECLARE @table TABLE(col1 INT IDENTITY(1,1), col2 INT)
INSERT INTO @table(col2) VALUES (2932)
INSERT INTO @table(col2) VALUES (142)
INSERT INTO @table(col2) VALUES (352)
INSERT INTO @table(col2) VALUES (342)
SET NOCOUNT ON
SELECT * FROM @table
SELECT @@rowcount
SET NOCOUNT OFF]]></description>
		<content:encoded><![CDATA[<p>Kindly concentrate about what is Pinal wanted to emphasis&#8230; don&#8217;t mind; you can find out order here.</p>
<p>DECLARE @table TABLE(col1 INT IDENTITY(1,1), col2 INT)<br />
INSERT INTO @table(col2) VALUES (2932)<br />
INSERT INTO @table(col2) VALUES (142)<br />
INSERT INTO @table(col2) VALUES (352)<br />
INSERT INTO @table(col2) VALUES (342)<br />
SET NOCOUNT ON<br />
SELECT * FROM @table<br />
SELECT @@rowcount<br />
SET NOCOUNT OFF</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: davidbridge</title>
		<link>http://blog.sqlauthority.com/2011/12/02/sql-server-effect-of-set-no-count-on-rowcount/#comment-209241</link>
		<dc:creator><![CDATA[davidbridge]]></dc:creator>
		<pubDate>Fri, 02 Dec 2011 08:21:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=16112#comment-209241</guid>
		<description><![CDATA[In your example @@ROWCOUNT is being read immediately AFTER the SELECT statement
It is true that issuing a statement between the select and the @@rowcount would cause the row count to be reset to 0 and in your text above it reads a little like you are trying to make this point, however, I don’t think you your example makes this very clear.

e.g.

SELECT * FROM sys.master_files
SET NOCOUNT ON
SELECT @@rowcount

Will return a zero result but it has nothing to do with the effect of SET ROWCOUNT ON, it is purely because there is a statement between the DML and the @@Rowcount querry (it could have been almost any not result statement).

The point I think you are trying to make here is that the NOCOUNT statement only affects the information messages and not the DML statement results hence, in the following example, SELECT @@Rowcount returns a value regardless of the setting of SET NOCOUNT, however no count message is sent to the messages window.

SET NOCOUNT ON
SELECT * FROM sys.master_files
SELECT @@rowcount

David Bridge
http://davidbridge.wordpress.com/]]></description>
		<content:encoded><![CDATA[<p>In your example @@ROWCOUNT is being read immediately AFTER the SELECT statement<br />
It is true that issuing a statement between the select and the @@rowcount would cause the row count to be reset to 0 and in your text above it reads a little like you are trying to make this point, however, I don’t think you your example makes this very clear.</p>
<p>e.g.</p>
<p>SELECT * FROM sys.master_files<br />
SET NOCOUNT ON<br />
SELECT @@rowcount</p>
<p>Will return a zero result but it has nothing to do with the effect of SET ROWCOUNT ON, it is purely because there is a statement between the DML and the @@Rowcount querry (it could have been almost any not result statement).</p>
<p>The point I think you are trying to make here is that the NOCOUNT statement only affects the information messages and not the DML statement results hence, in the following example, SELECT @@Rowcount returns a value regardless of the setting of SET NOCOUNT, however no count message is sent to the messages window.</p>
<p>SET NOCOUNT ON<br />
SELECT * FROM sys.master_files<br />
SELECT @@rowcount</p>
<p>David Bridge<br />
<a href="http://davidbridge.wordpress.com/" rel="nofollow">http://davidbridge.wordpress.com/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Naqui Ahmed</title>
		<link>http://blog.sqlauthority.com/2011/12/02/sql-server-effect-of-set-no-count-on-rowcount/#comment-209206</link>
		<dc:creator><![CDATA[Naqui Ahmed]]></dc:creator>
		<pubDate>Fri, 02 Dec 2011 07:23:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=16112#comment-209206</guid>
		<description><![CDATA[I too got the error in 2008R2...

then I used below script to get the O/P...

DECLARE @table TABLE(col1 INT IDENTITY(1,1), col2 INT)
INSERT INTO @table(col2) SELECT (2932) UNION SELECT(142) UNION SELECT(352) UNION SELECT(342)
SET NOCOUNT ON
SELECT * FROM @table
SELECT @@rowcount
SET NOCOUNT OFF]]></description>
		<content:encoded><![CDATA[<p>I too got the error in 2008R2&#8230;</p>
<p>then I used below script to get the O/P&#8230;</p>
<p>DECLARE @table TABLE(col1 INT IDENTITY(1,1), col2 INT)<br />
INSERT INTO @table(col2) SELECT (2932) UNION SELECT(142) UNION SELECT(352) UNION SELECT(342)<br />
SET NOCOUNT ON<br />
SELECT * FROM @table<br />
SELECT @@rowcount<br />
SET NOCOUNT OFF</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Niall</title>
		<link>http://blog.sqlauthority.com/2011/12/02/sql-server-effect-of-set-no-count-on-rowcount/#comment-209060</link>
		<dc:creator><![CDATA[Niall]]></dc:creator>
		<pubDate>Fri, 02 Dec 2011 02:49:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=16112#comment-209060</guid>
		<description><![CDATA[Interesting - this is what I get in 2008R2.

Msg 102, Level 15, State 1, Line 2
Incorrect syntax near &#039;,&#039;.


using
[code]
DECLARE @table TABLE(col1 INT IDENTITY(1,1), col2 INT)
INSERT INTO @table(col2) VALUES (2932),(142),(352),(342)
SET NOCOUNT ON
SELECT * FROM @table
SELECT @@rowcount
SET NOCOUNT OFF
[/code]]]></description>
		<content:encoded><![CDATA[<p>Interesting &#8211; this is what I get in 2008R2.</p>
<p>Msg 102, Level 15, State 1, Line 2<br />
Incorrect syntax near &#8216;,&#8217;.</p>
<p>using</p>
<pre class="brush: plain; title: ; notranslate">
DECLARE @table TABLE(col1 INT IDENTITY(1,1), col2 INT)
INSERT INTO @table(col2) VALUES (2932),(142),(352),(342)
SET NOCOUNT ON
SELECT * FROM @table
SELECT @@rowcount
SET NOCOUNT OFF
</pre>
]]></content:encoded>
	</item>
</channel>
</rss>
