<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>TechiesWeb &#187; Misc</title>
	<atom:link href="http://www.techiesweb.net/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.techiesweb.net</link>
	<description>Programming tips &#38; tricks,What went wrong while coding,Code snippets,ASP,ASP.NET,PHP,MySQL,SQL Server,jQuery,AJAX</description>
	<lastBuildDate>Tue, 22 Dec 2009 10:21:08 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>SET NOCOUNT ON and SQL storded procedure performance</title>
		<link>http://www.techiesweb.net/2009/11/set-nocount-on-and-sql-storded-procedure-performance/</link>
		<comments>http://www.techiesweb.net/2009/11/set-nocount-on-and-sql-storded-procedure-performance/#comments</comments>
		<pubDate>Sat, 07 Nov 2009 06:45:08 +0000</pubDate>
		<dc:creator>Shyju</dc:creator>
				<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://www.techiesweb.net/?p=3</guid>
		<description><![CDATA[SET NOCOUNT ON
When we run a Select /Insert/ Update or Delete statement against a DB table,we usually get a message like n rows affected .When we run the query in query analyzer for some manual debugging this message is quite helpful.But when u run the same query using a stored procedure,Why do we need this. [...]]]></description>
			<content:encoded><![CDATA[<p><strong><span style="font-size: small;">SET NOCOUNT ON</span></strong></p>
<p><span style="font-size: small;">When we run a Select /Insert/ Update or Delete statement against a DB table,we usually get a message like</span> <em><strong>n rows affected</strong></em> .When we run the query in query analyzer for some manual debugging this message is quite helpful.But when u run the same query using a stored procedure,Why do we need this. Obviously this would be an overhead since it would take the network traffic too to convey this message back to the calle (From a DB server to the Data Access layer code) .Usage of SET NOCOUNT ON avoids this problem.It will stop sql server from sending this message back to the calle ,hence improve the performance.So its always a good practice to use SET NO COUNT ON in all your stored procedures to make your application more faster</p>
<p><strong>Example</strong></p>
<p>ALTER PROCEDURE SaveUserData(<br />
@firstName nvarchar (50),<br />
@lastName nvarchar (50),<br />
@email  nvarchar(50))</p>
<p>AS<br />
SET NOCOUNT ON</p>
<p>BEGIN<br />
INSERT INTO USER_MASTER(FIRST_NAME,LAST_NAME,EMAIL) values (@firstName,@lastName,@email)</p>
<p>END</p>
<p><a href="http://msdn.microsoft.com/en-us/library/aa259204%28SQL.80%29.aspx" target="_blank">Official microsoft link</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.techiesweb.net/2009/11/set-nocount-on-and-sql-storded-procedure-performance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
