<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>SQL Server Rider</title>
	
	<link>http://sqlserverrider.wordpress.com</link>
	<description>Database and Business Intelligence</description>
	<lastBuildDate>Wed, 22 May 2013 06:11:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain="sqlserverrider.wordpress.com" port="80" path="/?rsscloud=notify" registerProcedure="" protocol="http-post" />
<image>
		<url>http://1.gravatar.com/blavatar/1096ae23d1aa3c8106d2f3b498451963?s=96&amp;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>SQL Server Rider</title>
		<link>http://sqlserverrider.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://sqlserverrider.wordpress.com/osd.xml" title="SQL Server Rider" />
	
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/wordpress/Xxor" /><feedburner:info uri="wordpress/xxor" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://sqlserverrider.wordpress.com/?pushpress=hub" /><feedburner:emailServiceId>wordpress/Xxor</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Compile SQL satements without execution – Set Statements – SQL Server</title>
		<link>http://feedproxy.google.com/~r/wordpress/Xxor/~3/6m6WoOfPcB0/</link>
		<comments>http://sqlserverrider.wordpress.com/2013/05/22/compile-sql-satements-without-execution-set-statements-sql-server/#comments</comments>
		<pubDate>Wed, 22 May 2013 06:11:58 +0000</pubDate>
		<dc:creator>Ayyappan Thangaraj</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[#SQLSERVER]]></category>
		<category><![CDATA[@adolfayyappan]]></category>
		<category><![CDATA[set]]></category>
		<category><![CDATA[SET NOEXEC]]></category>
		<category><![CDATA[SQLRider]]></category>
		<category><![CDATA[sqlserverrider]]></category>

		<guid isPermaLink="false">http://sqlserverrider.wordpress.com/?p=7424</guid>
		<description><![CDATA[SET NOEXEC: This set statement configure the current SQL session to compile only mode. It helps developers to validate the syntax of the query and transact-sql by compiling the code and it will not execute. Usage SET NOEXEC  ON  or &#8230; <a href="http://sqlserverrider.wordpress.com/2013/05/22/compile-sql-satements-without-execution-set-statements-sql-server/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlserverrider.wordpress.com&#038;blog=22861250&#038;post=7424&#038;subd=sqlserverrider&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>SET NOEXEC: This set statement configure the current SQL session to compile only mode. It helps developers to validate the syntax of the query and transact-sql by compiling the code and it will not execute.</p>
<p><strong>Usage</strong></p>
<address>SET NOEXEC  ON </address>
<address>or</address>
<address>SET NOEXEC OFF </address>
<address> </address>
<p><strong>Example</strong></p>
<p>1. NOEXEC set statement is on. In this example, I am executing a TSQL statement to create a procedure.</p>
<p><a href="http://sqlserverrider.files.wordpress.com/2013/05/pic114.png"><img class="aligncenter size-full wp-image-7426" alt="pic1" src="http://sqlserverrider.files.wordpress.com/2013/05/pic114.png?w=640"   /></a>2. NOEXEC set statement is off. This select statement returns the result-set now.</p>
<p><a href="http://sqlserverrider.files.wordpress.com/2013/05/pic211.png"><img class="aligncenter size-full wp-image-7427" alt="pic2" src="http://sqlserverrider.files.wordpress.com/2013/05/pic211.png?w=640"   /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlserverrider.wordpress.com/7424/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlserverrider.wordpress.com/7424/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlserverrider.wordpress.com&#038;blog=22861250&#038;post=7424&#038;subd=sqlserverrider&#038;ref=&#038;feed=1" width="1" height="1" /><img src="http://feeds.feedburner.com/~r/wordpress/Xxor/~4/6m6WoOfPcB0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sqlserverrider.wordpress.com/2013/05/22/compile-sql-satements-without-execution-set-statements-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/e0b63be776ce8b2e674ad5fd7ce45536?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">sqldwh</media:title>
		</media:content>

		<media:content url="http://sqlserverrider.files.wordpress.com/2013/05/pic114.png" medium="image">
			<media:title type="html">pic1</media:title>
		</media:content>

		<media:content url="http://sqlserverrider.files.wordpress.com/2013/05/pic211.png" medium="image">
			<media:title type="html">pic2</media:title>
		</media:content>
	<feedburner:origLink>http://sqlserverrider.wordpress.com/2013/05/22/compile-sql-satements-without-execution-set-statements-sql-server/</feedburner:origLink></item>
		<item>
		<title>Stop showing row count information for the current session – SET Statements – SQL Server</title>
		<link>http://feedproxy.google.com/~r/wordpress/Xxor/~3/iP2wwTAl0gI/</link>
		<comments>http://sqlserverrider.wordpress.com/2013/05/20/stop-showing-row-count-information-for-the-current-session-set-statements-sql-server/#comments</comments>
		<pubDate>Tue, 21 May 2013 05:29:45 +0000</pubDate>
		<dc:creator>Ayyappan Thangaraj</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[#SQLSERVER]]></category>
		<category><![CDATA[@@RowCount]]></category>
		<category><![CDATA[NOCOUNT]]></category>
		<category><![CDATA[set]]></category>
		<category><![CDATA[set statements]]></category>
		<category><![CDATA[sql server rider]]></category>
		<category><![CDATA[SQLRider]]></category>

		<guid isPermaLink="false">http://sqlserverrider.wordpress.com/?p=7416</guid>
		<description><![CDATA[SET NOCOUNT: This set statement tells SQL Server to show or hide the number of row affected by the transact SQL or stored procedure or any other statement that returns rows affected by the last executed SQL statement. But, It &#8230; <a href="http://sqlserverrider.wordpress.com/2013/05/20/stop-showing-row-count-information-for-the-current-session-set-statements-sql-server/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlserverrider.wordpress.com&#038;blog=22861250&#038;post=7416&#038;subd=sqlserverrider&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>SET NOCOUNT: This set statement tells SQL Server to show or hide the number of row affected by the transact SQL or stored procedure or any other statement that returns rows affected by the last executed SQL statement. But, It does not prevent updating the <a title="@@RowCount Vs RowCount_Big()" href="http://sqlserverrider.wordpress.com/2012/12/14/rowcount-vs-rowcount_big/">@@ROWCOUNT</a> statement.</p>
<p>usage:</p>
<address>SET NOCOUNT ON</address>
<address>or</address>
<address>SET NOCOUNT OFF</address>
<address> </address>
<p><strong>Example</strong></p>
<p>1. when NOCOUNT is off, SQL Server will return the number of rows affected by the last executed query.</p>
<p><a href="http://sqlserverrider.files.wordpress.com/2013/05/pic113.png"><img class="aligncenter size-full wp-image-7419" alt="pic1" src="http://sqlserverrider.files.wordpress.com/2013/05/pic113.png?w=640"   /></a>2. when NOCOUNT is ON, it will not return the number of rows affected value.</p>
<p><a href="http://sqlserverrider.files.wordpress.com/2013/05/pic210.png"><img class="aligncenter size-full wp-image-7420" alt="pic2" src="http://sqlserverrider.files.wordpress.com/2013/05/pic210.png?w=640"   /></a>Nocount set statement can boost the performance of our application by eliminating the unwanted communication and data sending to the client. In this scenario, SQL Server does not send the message with rows affected by the last executed statement. So, it helps reduces network traffic in transaction processing system or an application with lots of client request.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlserverrider.wordpress.com/7416/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlserverrider.wordpress.com/7416/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlserverrider.wordpress.com&#038;blog=22861250&#038;post=7416&#038;subd=sqlserverrider&#038;ref=&#038;feed=1" width="1" height="1" /><img src="http://feeds.feedburner.com/~r/wordpress/Xxor/~4/iP2wwTAl0gI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sqlserverrider.wordpress.com/2013/05/20/stop-showing-row-count-information-for-the-current-session-set-statements-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/e0b63be776ce8b2e674ad5fd7ce45536?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">sqldwh</media:title>
		</media:content>

		<media:content url="http://sqlserverrider.files.wordpress.com/2013/05/pic113.png" medium="image">
			<media:title type="html">pic1</media:title>
		</media:content>

		<media:content url="http://sqlserverrider.files.wordpress.com/2013/05/pic210.png" medium="image">
			<media:title type="html">pic2</media:title>
		</media:content>
	<feedburner:origLink>http://sqlserverrider.wordpress.com/2013/05/20/stop-showing-row-count-information-for-the-current-session-set-statements-sql-server/</feedburner:origLink></item>
		<item>
		<title>Get the metadata for a query without resultset- SET Statement – SQL Server</title>
		<link>http://feedproxy.google.com/~r/wordpress/Xxor/~3/eJi-69nnw44/</link>
		<comments>http://sqlserverrider.wordpress.com/2013/05/20/get-the-metadata-for-a-query-without-resultset-set-statement-sql-server/#comments</comments>
		<pubDate>Mon, 20 May 2013 06:10:03 +0000</pubDate>
		<dc:creator>Ayyappan Thangaraj</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[#SQLSERVER]]></category>
		<category><![CDATA[set]]></category>
		<category><![CDATA[sp_describe_first_result_set]]></category>
		<category><![CDATA[sp_describe_undeclared_parameters]]></category>
		<category><![CDATA[sql server rider]]></category>
		<category><![CDATA[SQLRider]]></category>
		<category><![CDATA[sys.dm_exec_describe_first_result_set]]></category>
		<category><![CDATA[sys.dm_exec_describe_first_result_set_for_object]]></category>

		<guid isPermaLink="false">http://sqlserverrider.wordpress.com/?p=7410</guid>
		<description><![CDATA[SET FMTONLY is used to set up the current SQL server session to return only metadata for the SQL query execution without resultset. This set option is useful when we develop an application interface for the database. It saves a &#8230; <a href="http://sqlserverrider.wordpress.com/2013/05/20/get-the-metadata-for-a-query-without-resultset-set-statement-sql-server/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlserverrider.wordpress.com&#038;blog=22861250&#038;post=7410&#038;subd=sqlserverrider&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>SET FMTONLY is used to set up the current SQL server session to return only metadata for the SQL query execution without resultset.</p>
<p>This set option is useful when we develop an application interface for the database. It saves a lot of  query execution time with out processing the data in the development phase.</p>
<p>Note: This feature will not be available in future release and there are other functions that are used as an alternative for this.</p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/ff878602">sp_describe_first_result_set (Transact-SQL)</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/ff878260">sp_describe_undeclared_parameters (Transact-SQL)</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/ff878258">sys.dm_exec_describe_first_result_set (Transact-SQL)</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/ff878236">sys.dm_exec_describe_first_result_set_for_object (Transact-SQL)</a>.</li>
</ul>
<p><strong>Usage</strong></p>
<address>SET FMTONLY ON</address>
<address>or</address>
<address>SET FMTONLY OFF</address>
<p><strong>Example</strong></p>
<p>1. Set format only to on.</p>
<p><a href="http://sqlserverrider.files.wordpress.com/2013/05/pic112.png"><img class="aligncenter size-full wp-image-7411" alt="pic1" src="http://sqlserverrider.files.wordpress.com/2013/05/pic112.png?w=640&#038;h=216" width="640" height="216" /></a>2. Set format only to off.</p>
<p><a href="http://sqlserverrider.files.wordpress.com/2013/05/pic29.png"><img class="aligncenter size-full wp-image-7412" alt="pic2" src="http://sqlserverrider.files.wordpress.com/2013/05/pic29.png?w=640&#038;h=291" width="640" height="291" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlserverrider.wordpress.com/7410/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlserverrider.wordpress.com/7410/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlserverrider.wordpress.com&#038;blog=22861250&#038;post=7410&#038;subd=sqlserverrider&#038;ref=&#038;feed=1" width="1" height="1" /><img src="http://feeds.feedburner.com/~r/wordpress/Xxor/~4/eJi-69nnw44" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sqlserverrider.wordpress.com/2013/05/20/get-the-metadata-for-a-query-without-resultset-set-statement-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/e0b63be776ce8b2e674ad5fd7ce45536?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">sqldwh</media:title>
		</media:content>

		<media:content url="http://sqlserverrider.files.wordpress.com/2013/05/pic112.png" medium="image">
			<media:title type="html">pic1</media:title>
		</media:content>

		<media:content url="http://sqlserverrider.files.wordpress.com/2013/05/pic29.png" medium="image">
			<media:title type="html">pic2</media:title>
		</media:content>
	<feedburner:origLink>http://sqlserverrider.wordpress.com/2013/05/20/get-the-metadata-for-a-query-without-resultset-set-statement-sql-server/</feedburner:origLink></item>
		<item>
		<title>Show or Hide SQL Warnings – SET Statement – SQL Server</title>
		<link>http://feedproxy.google.com/~r/wordpress/Xxor/~3/FMuJbvtZT9s/</link>
		<comments>http://sqlserverrider.wordpress.com/2013/05/18/show-or-hide-sql-warnings-set-statement-sql-server/#comments</comments>
		<pubDate>Sun, 19 May 2013 05:53:47 +0000</pubDate>
		<dc:creator>Ayyappan Thangaraj</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[#SQLSERVER]]></category>
		<category><![CDATA[ansi_warnings]]></category>
		<category><![CDATA[set]]></category>
		<category><![CDATA[set statement]]></category>
		<category><![CDATA[SQL Rider]]></category>
		<category><![CDATA[sql server rider]]></category>

		<guid isPermaLink="false">http://sqlserverrider.wordpress.com/?p=7404</guid>
		<description><![CDATA[ANSI_WARNINGS Specifies ISO standard behavior for errors in SQL Server. It helps to show and hide the error messages during query execution. Usage SET ANSI_WARNINGS ON or SET ANSI_WARNINGS OFF   If ANSI_WARNINGS is ON than warning will be raised when &#8230; <a href="http://sqlserverrider.wordpress.com/2013/05/18/show-or-hide-sql-warnings-set-statement-sql-server/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlserverrider.wordpress.com&#038;blog=22861250&#038;post=7404&#038;subd=sqlserverrider&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>ANSI_WARNINGS Specifies ISO standard behavior for errors in SQL Server. It helps to show and hide the error messages during query execution.</p>
<p><strong>Usage</strong></p>
<address>SET ANSI_WARNINGS ON</address>
<address>or</address>
<address>SET ANSI_WARNINGS OFF</address>
<address> </address>
<p>If ANSI_WARNINGS is ON than warning will be raised when the SQL statements has problem while execution. such as, null value in aggregate function returns warning message. So, I have used aggregation function in the below given example to show how this set statement treats the error messages.</p>
<p><a href="http://sqlserverrider.files.wordpress.com/2013/05/pic111.png"><img class="aligncenter size-full wp-image-7406" alt="pic1" src="http://sqlserverrider.files.wordpress.com/2013/05/pic111.png?w=640"   /></a>If ANSI_WARNINGS is OFF then warnings will not be shown.</p>
<p><a href="http://sqlserverrider.files.wordpress.com/2013/05/pic28.png"><img class="aligncenter size-full wp-image-7407" alt="pic2" src="http://sqlserverrider.files.wordpress.com/2013/05/pic28.png?w=640"   /></a>If  ANSI_WARNINGS is set to OFF then the divide-by-zero and arithmetic overflow errors returns null values. Else, it rolled back the transaction and throws an error message.</p>
<p>SET ANSI_WARNINGS must be ON when we are creating or using indexes on computed columns or indexed views. If SET ANSI_WARNINGS is OFF, CREATE, UPDATE, INSERT, and DELETE statements on tables with indexes on computed columns or indexed views will fail.</p>
<p>So, we should understand the use of this set statement and add this feature in our application properly.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlserverrider.wordpress.com/7404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlserverrider.wordpress.com/7404/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlserverrider.wordpress.com&#038;blog=22861250&#038;post=7404&#038;subd=sqlserverrider&#038;ref=&#038;feed=1" width="1" height="1" /><img src="http://feeds.feedburner.com/~r/wordpress/Xxor/~4/FMuJbvtZT9s" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sqlserverrider.wordpress.com/2013/05/18/show-or-hide-sql-warnings-set-statement-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/e0b63be776ce8b2e674ad5fd7ce45536?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">sqldwh</media:title>
		</media:content>

		<media:content url="http://sqlserverrider.files.wordpress.com/2013/05/pic111.png" medium="image">
			<media:title type="html">pic1</media:title>
		</media:content>

		<media:content url="http://sqlserverrider.files.wordpress.com/2013/05/pic28.png" medium="image">
			<media:title type="html">pic2</media:title>
		</media:content>
	<feedburner:origLink>http://sqlserverrider.wordpress.com/2013/05/18/show-or-hide-sql-warnings-set-statement-sql-server/</feedburner:origLink></item>
		<item>
		<title>Ignore arithmetic overflow error – SET Statement – SQL Server</title>
		<link>http://feedproxy.google.com/~r/wordpress/Xxor/~3/QdhER9-W67U/</link>
		<comments>http://sqlserverrider.wordpress.com/2013/05/17/ignore-arithmetic-overflow-error-set-statement-sql-server/#comments</comments>
		<pubDate>Sat, 18 May 2013 04:47:43 +0000</pubDate>
		<dc:creator>Ayyappan Thangaraj</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[#SQLSERVER]]></category>
		<category><![CDATA[@adolfayyappan]]></category>
		<category><![CDATA[ansi_warnings]]></category>
		<category><![CDATA[arithabort]]></category>
		<category><![CDATA[ARITHIGNORE]]></category>
		<category><![CDATA[set]]></category>
		<category><![CDATA[set statement]]></category>
		<category><![CDATA[sql server rider]]></category>
		<category><![CDATA[sqlserverrider]]></category>

		<guid isPermaLink="false">http://sqlserverrider.wordpress.com/?p=7399</guid>
		<description><![CDATA[ARITHIGNORE Set statement is used to control the messages raised by arithmetic overflow or divide-by-zero errors during a query execution. Usage SET ARITHIGNORE ON or SET ARITHIGNORE OFF   SET ARITHIGNORE setting only controls whether an error message is returned &#8230; <a href="http://sqlserverrider.wordpress.com/2013/05/17/ignore-arithmetic-overflow-error-set-statement-sql-server/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlserverrider.wordpress.com&#038;blog=22861250&#038;post=7399&#038;subd=sqlserverrider&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><strong>ARITHIGNORE</strong> Set statement is used to control the messages raised by arithmetic overflow or divide-by-zero errors during a query execution.</p>
<p><strong>Usage</strong></p>
<address>SET ARITHIGNORE ON</address>
<address>or</address>
<address>SET ARITHIGNORE OFF</address>
<address> </address>
<p>SET ARITHIGNORE setting only controls whether an error message is returned or not. IF set ON then no message else if set OFF message will be returned. NULL value is returned in both case.</p>
<p>The <a href="https://sqlserverrider.wordpress.com/2013/05/17/set-auto-rollback-transactions-due-to-arithmetic-overflow-set-statements-sql-server/">SET ARITHABORT</a> setting is used to determine whether the query is terminated in the event of arithmetic overflow or divide-by-zero error.</p>
<p>If SET ARITHABORT or SET ARITHIGNORE is OFF and SET ANSI_WARNINGS is ON then SQL Server still returns an error message when encountering divide-by-zero or overflow errors.</p>
<p>These set statement values are initialized by the SQL server while we create the session. So, It is mandatory to set all set statements properly to obtain the required result.</p>
<p>Get the current value of the set statements in the current session using <a href="https://sqlserverrider.wordpress.com/2013/02/26/get-the-current-values-of-set-options-sql-server/">@@OPTIONS</a>.</p>
<p><strong>Example</strong></p>
<p>1. When ARITHABORT and SET ANSI_WARNINGS is OFF,  ARITHIGNORE is ON. Null is returned due to the arithmetic errors.</p>
<p><a href="http://sqlserverrider.files.wordpress.com/2013/05/pic110.png"><img class="aligncenter size-full wp-image-7401" alt="pic1" src="http://sqlserverrider.files.wordpress.com/2013/05/pic110.png?w=640"   /></a>2. When ARITHABORT and SET ANSI_WARNINGS is OFF,  ARITHIGNORE is OFF. Null is returned due to the arithmetic errors and error message is also returned.</p>
<p><a href="http://sqlserverrider.files.wordpress.com/2013/05/pic27.png"><img class="aligncenter size-full wp-image-7402" alt="pic2" src="http://sqlserverrider.files.wordpress.com/2013/05/pic27.png?w=640"   /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlserverrider.wordpress.com/7399/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlserverrider.wordpress.com/7399/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlserverrider.wordpress.com&#038;blog=22861250&#038;post=7399&#038;subd=sqlserverrider&#038;ref=&#038;feed=1" width="1" height="1" /><img src="http://feeds.feedburner.com/~r/wordpress/Xxor/~4/QdhER9-W67U" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sqlserverrider.wordpress.com/2013/05/17/ignore-arithmetic-overflow-error-set-statement-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/e0b63be776ce8b2e674ad5fd7ce45536?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">sqldwh</media:title>
		</media:content>

		<media:content url="http://sqlserverrider.files.wordpress.com/2013/05/pic110.png" medium="image">
			<media:title type="html">pic1</media:title>
		</media:content>

		<media:content url="http://sqlserverrider.files.wordpress.com/2013/05/pic27.png" medium="image">
			<media:title type="html">pic2</media:title>
		</media:content>
	<feedburner:origLink>http://sqlserverrider.wordpress.com/2013/05/17/ignore-arithmetic-overflow-error-set-statement-sql-server/</feedburner:origLink></item>
		<item>
		<title>Set auto rollback transactions due to arithmetic overflow – SET Statements – SQL Server</title>
		<link>http://feedproxy.google.com/~r/wordpress/Xxor/~3/k2JGQeSpJ2U/</link>
		<comments>http://sqlserverrider.wordpress.com/2013/05/17/set-auto-rollback-transactions-due-to-arithmetic-overflow-set-statements-sql-server/#comments</comments>
		<pubDate>Fri, 17 May 2013 06:38:13 +0000</pubDate>
		<dc:creator>Ayyappan Thangaraj</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[#SQLSERVER]]></category>
		<category><![CDATA[ansi_warnings]]></category>
		<category><![CDATA[arithabort]]></category>
		<category><![CDATA[set statement]]></category>
		<category><![CDATA[SQL Rider]]></category>
		<category><![CDATA[SQLRider]]></category>
		<category><![CDATA[sqlserverrider]]></category>

		<guid isPermaLink="false">http://sqlserverrider.wordpress.com/?p=7388</guid>
		<description><![CDATA[SET ARITHABORT statement allows SQL Server to end the query execution whenever the system encounters arithmetic overflow or divide-by-zero error. This set statement is always on by default. But, we can turn this off. If it is off then we &#8230; <a href="http://sqlserverrider.wordpress.com/2013/05/17/set-auto-rollback-transactions-due-to-arithmetic-overflow-set-statements-sql-server/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlserverrider.wordpress.com&#038;blog=22861250&#038;post=7388&#038;subd=sqlserverrider&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>SET ARITHABORT statement allows SQL Server to end the query execution whenever the system encounters arithmetic overflow or divide-by-zero error. This set statement is always on by default. But, we can turn this off. If it is off then we may face poor performance problem and even query optimizer get different query.</p>
<p>Arithbort set statement becomes more effective if we use it with ansi_warnings set statement.</p>
<p>SET <strong>ARITHABORT</strong> ON + SET <strong>ANSI_WARNINGS</strong> ON = the query execution will be terminated if the system encounters arthimetic overflow or divide-by-zero error.</p>
<p><a href="http://sqlserverrider.files.wordpress.com/2013/05/pic19.png"><img class="aligncenter size-full wp-image-7390" alt="pic1" src="http://sqlserverrider.files.wordpress.com/2013/05/pic19.png?w=640"   /></a>SET <strong>ARITHABORT</strong> ON + SET <strong>ANSI_WARNINGS</strong> OFF = This will terminate SQL execution and If the errors occur in a transaction then the transaction will be rolled back.</p>
<p><a href="http://sqlserverrider.files.wordpress.com/2013/05/pic26.png"><img class="aligncenter size-full wp-image-7391" alt="pic2" src="http://sqlserverrider.files.wordpress.com/2013/05/pic26.png?w=640"   /></a>SET <strong>ARITHABORT</strong> OFF + SET <strong>ANSI_WARNINGS</strong> OFF = this will display a warning message  and NULL is assigned to the result of the arithmetic operation.</p>
<p><a href="http://sqlserverrider.files.wordpress.com/2013/05/pic33.png"><img class="aligncenter size-full wp-image-7392" alt="pic3" src="http://sqlserverrider.files.wordpress.com/2013/05/pic33.png?w=640"   /></a>note:  If SET ARITHABORT is OFF, CREATE, UPDATE, INSERT, and DELETE statements on tables with indexes on computed columns or indexed views will fail. So, ARITHABORT must be ON when we create or change indexes on computed columns or indexed views.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlserverrider.wordpress.com/7388/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlserverrider.wordpress.com/7388/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlserverrider.wordpress.com&#038;blog=22861250&#038;post=7388&#038;subd=sqlserverrider&#038;ref=&#038;feed=1" width="1" height="1" /><img src="http://feeds.feedburner.com/~r/wordpress/Xxor/~4/k2JGQeSpJ2U" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sqlserverrider.wordpress.com/2013/05/17/set-auto-rollback-transactions-due-to-arithmetic-overflow-set-statements-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/e0b63be776ce8b2e674ad5fd7ce45536?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">sqldwh</media:title>
		</media:content>

		<media:content url="http://sqlserverrider.files.wordpress.com/2013/05/pic19.png" medium="image">
			<media:title type="html">pic1</media:title>
		</media:content>

		<media:content url="http://sqlserverrider.files.wordpress.com/2013/05/pic26.png" medium="image">
			<media:title type="html">pic2</media:title>
		</media:content>

		<media:content url="http://sqlserverrider.files.wordpress.com/2013/05/pic33.png" medium="image">
			<media:title type="html">pic3</media:title>
		</media:content>
	<feedburner:origLink>http://sqlserverrider.wordpress.com/2013/05/17/set-auto-rollback-transactions-due-to-arithmetic-overflow-set-statements-sql-server/</feedburner:origLink></item>
		<item>
		<title>Control SQL locks using locking statements – SQL Server – SET Statements</title>
		<link>http://feedproxy.google.com/~r/wordpress/Xxor/~3/54UyJIrSfto/</link>
		<comments>http://sqlserverrider.wordpress.com/2013/05/15/control-sql-locks-using-locking-statements-sql-server-set-statements/#comments</comments>
		<pubDate>Wed, 15 May 2013 07:08:50 +0000</pubDate>
		<dc:creator>Ayyappan Thangaraj</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[#SQLSERVER]]></category>
		<category><![CDATA[deadlock]]></category>
		<category><![CDATA[set]]></category>
		<category><![CDATA[set statements]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[sql server rider]]></category>
		<category><![CDATA[SQLRider]]></category>
		<category><![CDATA[sqlserverrider]]></category>

		<guid isPermaLink="false">http://sqlserverrider.wordpress.com/?p=7382</guid>
		<description><![CDATA[Locking is an unavoidable activities in concurrency system. But, we can control and manage the resource effectively. But, in this blog post I am going to introduce a SET statement called DEADLOCK_PRIORITY. This is one of the locking set statement &#8230; <a href="http://sqlserverrider.wordpress.com/2013/05/15/control-sql-locks-using-locking-statements-sql-server-set-statements/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlserverrider.wordpress.com&#038;blog=22861250&#038;post=7382&#038;subd=sqlserverrider&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Locking is an unavoidable activities in concurrency system. But, we can control and manage the resource effectively. But, in this blog post I am going to introduce a SET statement called DEADLOCK_PRIORITY. This is one of the locking set statement in SQL Server. It tells how to react when dead lock occurs in the current session. As the name priority suggest that the importance or the order in which the deadlock should be treated with other processes.</p>
<p><strong>DEADLOCK_PRIORITY Syntax (SQL Server 2012)</strong></p>
<p>SET DEADLOCK_PRIORITY { LOW | NORMAL | HIGH | &lt;numeric-priority&gt; | @deadlock_var | @deadlock_intvar }</p>
<p>&lt;numeric-priority&gt; ::= { -10 | -9 | -8 | … | 0 | … | 8 | 9 | 10 }</p>
<p><strong>Argument description</strong></p>
<p>LOW, NORMAL and HIGH are the constant value pre-defined in SQL Server. The numeric value equivalent to the names are -5, 0 and 5 respectively. We can also use this strings in a variable to assign to the SET statement. And, We can also give any whole number value between -10 to 10 instead variable or constant. Setting low value means that the priority for the deadlock for that session is low and make the current session as deadlock victim.</p>
<p>Normal is the default value for DEADLOCK_PRIORITY.</p>
<p><strong>SET statement examples</strong></p>
<p>SET DEADLOCK_PRIORITY HIGH</p>
<p>or</p>
<p>Declare @dlVar as varchar(10) = &#8216;LOW&#8217;</p>
<p>SET DEADLOCK_PRIORITY @dlVar</p>
<p>or</p>
<p>SET DEADLOCK_PRIORITY -1</p>
<p><strong>Deadlock victim</strong></p>
<p>To resolves the deadlock by choosing one of the sessions as a deadlock victim. The current transaction of the deadlock victim is rolled back and deadlock error message 1205 is returned to the client. It helps the other session to continue its work without interruption. Priority value plays the vital role in choosing deadlock victim session.</p>
<p><strong>How does this SET statement react to the deadlock in concurrency system?</strong></p>
<p>When Session A&#8217;s DEADLOCK_PRIORITY is set with a value (-10 to 10) and If Deadlock occurred and the other session in the deadlock chain is having the DEADLOCK_PRIORITY value greater than Session A&#8217;s priority value then the Session A will be the deadlock victim.</p>
<p>if both sessions having same priority value than the SQL Server will choose the deadlock victim by estimating the cost to rollback the current transaction and choose the less cost session as deadlock victim.</p>
<p>I have already wrote a blog post about lock timeout set statement. Please read  <a href="https://sqlserverrider.wordpress.com/2013/03/23/lock_timeout-sql-server/" rel="bookmark">Lock_Timeout in SQL Server</a></p>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlserverrider.wordpress.com/7382/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlserverrider.wordpress.com/7382/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlserverrider.wordpress.com&#038;blog=22861250&#038;post=7382&#038;subd=sqlserverrider&#038;ref=&#038;feed=1" width="1" height="1" /><img src="http://feeds.feedburner.com/~r/wordpress/Xxor/~4/54UyJIrSfto" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sqlserverrider.wordpress.com/2013/05/15/control-sql-locks-using-locking-statements-sql-server-set-statements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/e0b63be776ce8b2e674ad5fd7ce45536?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">sqldwh</media:title>
		</media:content>
	<feedburner:origLink>http://sqlserverrider.wordpress.com/2013/05/15/control-sql-locks-using-locking-statements-sql-server-set-statements/</feedburner:origLink></item>
		<item>
		<title>Change the Date format of the current language – SQL Server – SET Statements</title>
		<link>http://feedproxy.google.com/~r/wordpress/Xxor/~3/nIrCDhaPF9g/</link>
		<comments>http://sqlserverrider.wordpress.com/2013/05/14/change-the-date-format-of-the-current-language-sql-server-set-statements/#comments</comments>
		<pubDate>Tue, 14 May 2013 06:59:53 +0000</pubDate>
		<dc:creator>Ayyappan Thangaraj</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[#SQLSERVER]]></category>
		<category><![CDATA[set dateformat]]></category>
		<category><![CDATA[set statements]]></category>
		<category><![CDATA[SQL Rider]]></category>
		<category><![CDATA[sql server rider]]></category>

		<guid isPermaLink="false">http://sqlserverrider.wordpress.com/?p=7375</guid>
		<description><![CDATA[Formatting date is one of the mandatory task for the developers to show date values in the user reports. There are various ways to format date in SQL Server database and reporting services. But, in this blog post I am &#8230; <a href="http://sqlserverrider.wordpress.com/2013/05/14/change-the-date-format-of-the-current-language-sql-server-set-statements/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlserverrider.wordpress.com&#038;blog=22861250&#038;post=7375&#038;subd=sqlserverrider&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Formatting date is one of the mandatory task for the developers to show date values in the user reports. There are various ways to format date in SQL Server database and reporting services. But, in this blog post I am going to show you how to set up the date format that user is going to use for the date value with rearranging the date part string (dmy) in SQL Server.</p>
<p>This setting only applies to date data type (date, smalldatetime, datetime, datetime2 and datetimeoffset) string value in an expression.</p>
<p>DateFormat set statement also overrides the date format defined in the default language settings. Learn about <a href="https://sqlserverrider.wordpress.com/2013/01/09/languages-in-sql-server/">Language in SQL Server</a></p>
<p><strong>Set statement syntax</strong></p>
<p>SET DATEFORMAT { format | @format_var }</p>
<p>Format or @format variable  must contain day (d), month (m) and year(y) combination format. For instance mdy, dmy, ymd, ydm, myd, and dym.</p>
<p>There are some restrictions applies to specific DateFormat format to use a date value stored in date, datetime2 and datetimeoffset data types. Because, we cannot use ydm format to use the date value.</p>
<p><a href="http://sqlserverrider.files.wordpress.com/2013/05/pic18.png"><img class="aligncenter size-full wp-image-7379" alt="pic1" src="http://sqlserverrider.files.wordpress.com/2013/05/pic18.png?w=640"   /></a>A valid expression</p>
<p><a href="http://sqlserverrider.files.wordpress.com/2013/05/pic25.png"><img class="aligncenter size-full wp-image-7380" alt="pic2" src="http://sqlserverrider.files.wordpress.com/2013/05/pic25.png?w=640"   /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlserverrider.wordpress.com/7375/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlserverrider.wordpress.com/7375/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlserverrider.wordpress.com&#038;blog=22861250&#038;post=7375&#038;subd=sqlserverrider&#038;ref=&#038;feed=1" width="1" height="1" /><img src="http://feeds.feedburner.com/~r/wordpress/Xxor/~4/nIrCDhaPF9g" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sqlserverrider.wordpress.com/2013/05/14/change-the-date-format-of-the-current-language-sql-server-set-statements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/e0b63be776ce8b2e674ad5fd7ce45536?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">sqldwh</media:title>
		</media:content>

		<media:content url="http://sqlserverrider.files.wordpress.com/2013/05/pic18.png" medium="image">
			<media:title type="html">pic1</media:title>
		</media:content>

		<media:content url="http://sqlserverrider.files.wordpress.com/2013/05/pic25.png" medium="image">
			<media:title type="html">pic2</media:title>
		</media:content>
	<feedburner:origLink>http://sqlserverrider.wordpress.com/2013/05/14/change-the-date-format-of-the-current-language-sql-server-set-statements/</feedburner:origLink></item>
		<item>
		<title>Control current session and specific information – SQL Server – SET Statements</title>
		<link>http://feedproxy.google.com/~r/wordpress/Xxor/~3/6pFBoE4Ql5M/</link>
		<comments>http://sqlserverrider.wordpress.com/2013/05/12/control-current-session-and-specific-information-sql-server-set-statements/#comments</comments>
		<pubDate>Mon, 13 May 2013 00:31:08 +0000</pubDate>
		<dc:creator>Ayyappan Thangaraj</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[#SQLSERVER]]></category>
		<category><![CDATA[set]]></category>
		<category><![CDATA[set statements]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Rider]]></category>
		<category><![CDATA[sql server rider]]></category>
		<category><![CDATA[SQLRider]]></category>

		<guid isPermaLink="false">http://sqlserverrider.wordpress.com/?p=7365</guid>
		<description><![CDATA[SET statement in SQL Server is used to handle a specific information (such as date format, displaying text length and etc) in the current session by altering the current session&#8217;s default set values. Some of the SET statements are already &#8230; <a href="http://sqlserverrider.wordpress.com/2013/05/12/control-current-session-and-specific-information-sql-server-set-statements/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlserverrider.wordpress.com&#038;blog=22861250&#038;post=7365&#038;subd=sqlserverrider&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>SET statement in SQL Server is used to handle a specific information (such as date format, displaying text length and etc) in the current session by altering the current session&#8217;s default set values. Some of the SET statements are already setup by the administrator at SQL instance level. So, when we initiate the session it applies all the default SET options to the user of that session. But, we have an option to alter that default value. Usually, we have to turn the set option ON or OFF and in some cases we have to pass some value to the set option. There are different groups of SET statements available in SQL Server as given below.</p>
<p><a href="http://sqlserverrider.files.wordpress.com/2013/05/pic16.png" target="_blank"><img class="aligncenter size-full wp-image-7367" alt="pic1" src="http://sqlserverrider.files.wordpress.com/2013/05/pic16.png?w=640"   /></a>I have discussed some of the functions that are related to SET statements in my blog post. Those are given below for reference.</p>
<ul>
<li><a href="https://sqlserverrider.wordpress.com/2013/02/26/get-the-current-values-of-set-options-sql-server/">get-the-current-values-of-set-options-sql-server</a></li>
<li><a href="https://sqlserverrider.wordpress.com/2013/03/09/set-textsize-and-textsize-sql-server/">set-textsize-and-textsize-sql-server</a></li>
<li><a href="https://sqlserverrider.wordpress.com/2012/11/13/set-first-day-of-the-week/">set-first-day-of-the-week</a></li>
<li><a href="https://sqlserverrider.wordpress.com/2013/05/03/insert-value-to-an-identity-column-sql-identity-sql-server/">SET IDENTITY_INSERT</a></li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlserverrider.wordpress.com/7365/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlserverrider.wordpress.com/7365/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlserverrider.wordpress.com&#038;blog=22861250&#038;post=7365&#038;subd=sqlserverrider&#038;ref=&#038;feed=1" width="1" height="1" /><img src="http://feeds.feedburner.com/~r/wordpress/Xxor/~4/6pFBoE4Ql5M" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sqlserverrider.wordpress.com/2013/05/12/control-current-session-and-specific-information-sql-server-set-statements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/e0b63be776ce8b2e674ad5fd7ce45536?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">sqldwh</media:title>
		</media:content>

		<media:content url="http://sqlserverrider.files.wordpress.com/2013/05/pic16.png" medium="image">
			<media:title type="html">pic1</media:title>
		</media:content>
	<feedburner:origLink>http://sqlserverrider.wordpress.com/2013/05/12/control-current-session-and-specific-information-sql-server-set-statements/</feedburner:origLink></item>
		<item>
		<title>Construct SQL statements using catalog views – SQL Server</title>
		<link>http://feedproxy.google.com/~r/wordpress/Xxor/~3/ZpCPwB05kOQ/</link>
		<comments>http://sqlserverrider.wordpress.com/2013/05/10/construct-sql-statements-using-catalog-views-sql-server/#comments</comments>
		<pubDate>Fri, 10 May 2013 15:07:43 +0000</pubDate>
		<dc:creator>Ayyappan Thangaraj</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[#SQLSERVER]]></category>
		<category><![CDATA[@adolfayyappan]]></category>
		<category><![CDATA[object catalog view]]></category>
		<category><![CDATA[SQL Rider]]></category>
		<category><![CDATA[sql server rider]]></category>

		<guid isPermaLink="false">http://sqlserverrider.wordpress.com/?p=7357</guid>
		<description><![CDATA[I recently worked on a project where there are some SQL statement that I need to write to insert, update and Delete the data in all columns in a set of tables. There may be some efficient way to implement &#8230; <a href="http://sqlserverrider.wordpress.com/2013/05/10/construct-sql-statements-using-catalog-views-sql-server/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlserverrider.wordpress.com&#038;blog=22861250&#038;post=7357&#038;subd=sqlserverrider&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I recently worked on a project where there are some SQL statement that I need to write to insert, update and Delete the data in all columns in a set of tables. There may be some efficient way to implement this task. But, I found one simple solution for my scenario.</p>
<p>I have used SQL catalog views to build my SQL Statements. My scenario was to update the columns by replacing a character in it.</p>
<p><strong>Example for building SQL Queries using catalog view</strong></p>
<p>select &#8216;UPDATE &#8216; + OBJECT_NAME(object_id) +&#8217; SET &#8216; + name + &#8216; = REPLACE(&#8216; + name +&#8217;, &#8221;+&#8221;,&#8221;&#8221;)&#8217; from sys.columns<br />
where left(OBJECT_NAME(object_id), 3) = &#8216;tbl&#8217;</p>
<p>This query generates SQL update statements to replace character + to nothing in each column in all the tables starts with &#8216;tbl&#8217; that I specified in the where clause.</p>
<p><strong>Execution</strong></p>
<p><a href="http://sqlserverrider.files.wordpress.com/2013/05/pic15.png"><img class="aligncenter size-full wp-image-7359" alt="pic1" src="http://sqlserverrider.files.wordpress.com/2013/05/pic15.png?w=640&#038;h=275" width="640" height="275" /></a>there could be some very good way to do this. but found it is very quick solution for me. This is not the stopping point we can also use other object catalog views to accomplish our task quickly and simply.</p>
<p><strong>object catalog views for reference</strong></p>
<p><a href="http://sqlserverrider.files.wordpress.com/2013/05/pic24.png"><img class="aligncenter size-full wp-image-7360" alt="pic2" src="http://sqlserverrider.files.wordpress.com/2013/05/pic24.png?w=640"   /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlserverrider.wordpress.com/7357/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlserverrider.wordpress.com/7357/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlserverrider.wordpress.com&#038;blog=22861250&#038;post=7357&#038;subd=sqlserverrider&#038;ref=&#038;feed=1" width="1" height="1" /><img src="http://feeds.feedburner.com/~r/wordpress/Xxor/~4/ZpCPwB05kOQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://sqlserverrider.wordpress.com/2013/05/10/construct-sql-statements-using-catalog-views-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/e0b63be776ce8b2e674ad5fd7ce45536?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">sqldwh</media:title>
		</media:content>

		<media:content url="http://sqlserverrider.files.wordpress.com/2013/05/pic15.png" medium="image">
			<media:title type="html">pic1</media:title>
		</media:content>

		<media:content url="http://sqlserverrider.files.wordpress.com/2013/05/pic24.png" medium="image">
			<media:title type="html">pic2</media:title>
		</media:content>
	<feedburner:origLink>http://sqlserverrider.wordpress.com/2013/05/10/construct-sql-statements-using-catalog-views-sql-server/</feedburner:origLink></item>
	</channel>
</rss>
