<?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/"
	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>Journey to SQL Authority with Pinal Dave &#187; Readers Question</title>
	<atom:link href="http://blog.sqlauthority.com/category/readers-question/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com</link>
	<description>Notes of a SQL Server MVP and Database Administrator</description>
	<lastBuildDate>Sun, 21 Mar 2010 01:30:28 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='blog.sqlauthority.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/08e35387c05b61340e885b1763a69d9f?s=96&#038;d=http://s2.wp.com/i/buttonw-com.png</url>
		<title>Journey to SQL Authority with Pinal Dave &#187; Readers Question</title>
		<link>http://blog.sqlauthority.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.sqlauthority.com/osd.xml" title="Journey to SQL Authority with Pinal Dave" />
	<atom:link rel='hub' href='http://blog.sqlauthority.com/?pushpress=hub'/>
		<item>
		<title>SQL SERVER &#8211; Fix : Error : 3117 : The log or differential backup cannot be restored because no files are ready to rollforward</title>
		<link>http://blog.sqlauthority.com/2010/03/21/sql-server-fix-error-3117-the-log-or-differential-backup-cannot-be-restored-because-no-files-are-ready-to-rollforward/</link>
		<comments>http://blog.sqlauthority.com/2010/03/21/sql-server-fix-error-3117-the-log-or-differential-backup-cannot-be-restored-because-no-files-are-ready-to-rollforward/#comments</comments>
		<pubDate>Sun, 21 Mar 2010 01:30:28 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Error Messages]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8254</guid>
		<description><![CDATA[I received the following email from one of my readers.
Dear Pinal,
I am new to SQL Server and our regular DBA is on vacation. Our production database had some problem and I have just restored full database backup to production server. When I try to apply log back I am getting following error. I am sure, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=8254&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">I received the following email from one of my readers.</p>
<p style="padding-left:30px;text-align:justify;"><em>Dear Pinal,</em></p>
<p style="padding-left:30px;text-align:justify;"><em>I am new to SQL Server and our regular DBA is on vacation. Our production database had some problem and I have just restored full database backup to production server. When I try to apply log back I am getting following error. I am sure, this is valid log backup file. Screenshot is attached.</em></p>
<p style="padding-left:30px;text-align:justify;"><em>[Few other details regarding server/ip address removed]</em></p>
<p style="padding-left:30px;text-align:justify;"><span style="color:#ff0000;"><em>Msg 3117, Level 16, State 1, Line 1<br />
The log or differential backup cannot be restored because no files are ready to roll forward.<br />
Msg 3013, Level 16, State 1, Line 1<br />
RESTORE LOG is terminating abnormally.</em></span></p>
<p style="padding-left:30px;text-align:justify;"><em>Screenshot attached. [Removed as it contained live IP address]</em></p>
<p style="padding-left:30px;text-align:justify;"><em>Please help immediately.</em></p>
<p style="text-align:justify;">Well I have answered this question in my earlier post, 2 years ago, over here <a href="http://blog.sqlauthority.com/2007/09/02/sql-server-fix-error-msg-3117-level-16-state-4-the-log-or-differential-backup-cannot-be-restored-because-no-files-are-ready-to-rollforward/" target="_blank">SQL SERVER – Fix : Error : Msg 3117, Level 16, State 4 The log or differential backup cannot be restored because no files are ready to rollforward</a>. However, I will try to explain it a little more this time.</p>
<p style="text-align:justify;">For SQL Server database to be used it should in online state. There are multiple states of SQL Server Database.</p>
<ul style="text-align:justify;">
<li>ONLINE      (Available &#8211; online for data)</li>
<li>OFFLINE</li>
<li>RESTORING</li>
<li>RECOVERING</li>
<li>RECOVERY      PENDING</li>
<li>SUSPECT</li>
<li>EMERGENCY      (Limited Availability)</li>
</ul>
<p style="text-align:justify;">If the database is online, it means it is active and in operational mode. It will not make sense to apply further log from backup if the operations have continued on this database. The common practice during the backup restore process is to specify the keyword RECOVERY when the database is restored. When RECOVERY keyword is specified, the SQL Server brings back the database online and will not accept any further log backups.</p>
<p style="text-align:justify;">However, if you want to restore more than one backup files, i.e. after restoring the full back up if you want to apply further differential or log backup you cannot do that when database is online and already active. You need to have your database in the state where it can further accept the backup data and not the online data request. If the SQL Server is online and also accepts database backup file, then there can be data inconsistency. This is the reason that when there are more than one database backup files to be restored, one has to restore the database with NO RECOVERY keyword in the RESTORE operation.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/recoverybackup.jpg" alt="" width="436" height="201" /></p>
<p style="text-align:justify;">I suggest you all to read one more post written by me earlier. In this post, I explained the time line with image and graphic <a href="http://blog.sqlauthority.com/2009/07/14/sql-server-backup-timeline-and-understanding-of-database-restore-process-in-full-recovery-model/" target="_blank"><strong>SQL SERVER – Backup Timeline and Understanding of Database Restore Process in Full Recovery Model.</strong></a></p>
<p style="text-align:justify;">Sample Code for reference:</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">RESTORE DATABASE </span><span style="color:black;">AdventureWorks<br />
</span><span style="color:blue;">FROM DISK = </span><span style="color:red;">'C:\AdventureWorksFull.bak'<br />
</span><span style="color:blue;">WITH </span><span style="color:black;">NORECOVERY</span><span style="color:gray;">;<br />
</span><span style="color:blue;">RESTORE DATABASE </span><span style="color:black;">AdventureWorks<br />
</span><span style="color:blue;">FROM DISK = </span><span style="color:red;">'C:\AdventureWorksDiff.bak'<br />
</span><span style="color:blue;">WITH </span><span style="color:black;">RECOVERY</span><span style="color:gray;">;</span></code></p>
<p style="text-align:justify;">In this post, I am not trying to cover complete backup and recovery. I am just attempting to address one type of error and its resolution. Please test these scenarios on the development server. Playing with live database backup and recovery is always very crucial and needs to be properly planned. Leave a comment here if you need help with this subject.</p>
<p style="text-align:justify;"><strong>Similar Post:<br />
<a href="http://blog.sqlauthority.com/2009/07/15/sql-server-restore-sequence-and-understanding-norecovery-and-recovery/" target="_blank">SQL SERVER – Restore Sequence and Understanding NORECOVERY and RECOVERY</a></strong></p>
<p style="text-align:justify;">Note: We will cover Standby Server maintenance and Recovery in another blog post and it is intentionally, not covered this post.</p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/readers-question/'>Readers Question</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/sql-backup-and-restore/'>SQL Backup and Restore</a>, <a href='http://blog.sqlauthority.com/category/sql-error-messages/'>SQL Error Messages</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/tech/sql-scripts/'>SQL Scripts</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/8254/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/8254/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/8254/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/8254/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/8254/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/8254/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/8254/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/8254/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/8254/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/8254/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=8254&subd=sqlauthority&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2010/03/21/sql-server-fix-error-3117-the-log-or-differential-backup-cannot-be-restored-because-no-files-are-ready-to-rollforward/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/recoverybackup.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Interview Questions &amp; Answers Needs Your Help</title>
		<link>http://blog.sqlauthority.com/2010/03/19/sql-server-interview-questions-answers-needs-your-help/</link>
		<comments>http://blog.sqlauthority.com/2010/03/19/sql-server-interview-questions-answers-needs-your-help/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 01:30:50 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Contribution]]></category>
		<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL Download]]></category>
		<category><![CDATA[SQL Interview Questions and Answers]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[codeproject]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8242</guid>
		<description><![CDATA[About an year ago, I had posted SQL Server related Interview Questions and Answers. It was very well received in community. I have received many comments, suggestions and emails on this subject. I am planning to upgrade the Interview Questions and Answers and take it to next level.
Here, I need your help. Please your comments, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=8242&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">About an year ago, I had posted SQL Server related <strong><a href="http://blog.sqlauthority.com/sql-server-interview-questions-and-answers/" target="_blank">Interview Questions and Answers</a></strong>. It was very well received in community. I have received many comments, suggestions and emails on this subject. I am planning to upgrade the Interview Questions and Answers and take it to next level.</p>
<p style="text-align:justify;"><span style="color:#ff0000;"><em><strong>Here, I need your help.</strong></em></span> Please your comments, suggestions, expectation or potential interview Question (along with answer) here. Your input will be very valuable. As time goes by we all learn and get better. There were few things missing at that time when those interview questions and answers were prepared, now is the time to complete the gap and make this interview questions more useful.</p>
<p style="text-align:justify;"><em>If you know all, this Question and Answers are not for you.</em> This are for those who is eager to learn and need help in the area.</p>
<p style="text-align:justify;">If you do not want to leave a comment, I suggest to send me email at pinal &#8220;at&#8221; SQLAuthority.com</p>
<p style="text-align:justify;">Following is the reproduction of original consolidation post for quick reference.</p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2008/09/12/sql-server-2008-interview-questions-and-answers-part-1/"><strong>SQL  SERVER – 2008 – Interview Questions and Answers – Part 1</strong></a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2008/09/13/sql-server-2008-interview-questions-and-answers-part-2/"><strong>SQL  SERVER – 2008 – Interview Questions and Answers – Part 2</strong></a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2008/09/14/sql-server-2008-interview-questions-and-answers-part-3/"><strong>SQL  SERVER – 2008 – Interview Questions and Answers – Part 3</strong></a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2008/09/15/sql-server-2008-interview-questions-and-answers-part-4/"><strong>SQL  SERVER – 2008 – Interview Questions and Answers – Part 4</strong></a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2008/09/16/sql-server-2008-interview-questions-and-answers-part-5/"><strong>SQL  SERVER – 2008 – Interview Questions and Answers – Part 5</strong></a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2008/09/17/sql-server-2008-interview-questions-and-answers-part-6/"><strong>SQL  SERVER – 2008 – Interview Questions and Answers – Part 6</strong></a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2008/09/18/sql-server-2008-interview-questions-and-answers-part-7/"><strong>SQL  SERVER – 2008 – Interview Questions and Answers – Part 7</strong></a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2008/09/19/sql-server-2008-interview-questions-and-answers-part-8/"><strong>SQL  SERVER – 2008 – Interview Questions and Answers – Part 8</strong></a></p>
<p style="text-align:justify;"><a href="http://www.pinaldave.com/best-sql-server-download.cfm?download=SQL-SERVER-2008-Download-Interview-Questions-and-Answers"><strong>Download  SQL Server 2008 Interview Questions and Answers Complete List</strong></a></p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (<a href="http://blog.sqlauthority.com/" target="_blank">http://blog.SQLAuthority.com</a>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/readers-contribution/'>Readers Contribution</a>, <a href='http://blog.sqlauthority.com/category/readers-question/'>Readers Question</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/sql-documentation/'>SQL Documentation</a>, <a href='http://blog.sqlauthority.com/category/sql-download/'>SQL Download</a>, <a href='http://blog.sqlauthority.com/category/sql-interview-questions-and-answers/'>SQL Interview Questions and Answers</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a> Tagged: <a href='http://blog.sqlauthority.com/tag/codeproject/'>codeproject</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/8242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/8242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/8242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/8242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/8242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/8242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/8242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/8242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/8242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/8242/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=8242&subd=sqlauthority&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2010/03/19/sql-server-interview-questions-answers-needs-your-help/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER &#8211; MAXDOP Settings to Limit Query to Run on Specific CPU</title>
		<link>http://blog.sqlauthority.com/2010/03/15/sql-server-maxdop-settings-to-limit-query-to-run-on-specific-cpu/</link>
		<comments>http://blog.sqlauthority.com/2010/03/15/sql-server-maxdop-settings-to-limit-query-to-run-on-specific-cpu/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 01:30:32 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Performance]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQLServer]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[MAXDOP]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8198</guid>
		<description><![CDATA[This is very simple and known tip. Query Hint MAXDOP &#8211; Maximum Degree Of Parallelism can be set to restrict query to run on a certain CPU. Please note that this query cannot restrict or dictate which CPU to be used, but for sure, it restricts the usage of number of CPUs in a single [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=8198&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">This is very simple and known tip. Query Hint MAXDOP &#8211; Maximum Degree Of Parallelism can be set to restrict query to run on a certain CPU. Please note that this query cannot restrict or dictate which CPU to be used, but for sure, it restricts the usage of number of CPUs in a single batch.</p>
<p style="text-align:justify;">Let us consider the following example of this query.</p>
<p style="text-align:justify;">The following query usually runs on multicore on a dual core machine (please note it may not be the case with your machine).</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">AdventureWorks<br />
GO<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">*<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">Sales.SalesOrderDetail<br />
</span><span style="color:blue;">ORDER BY </span><span style="color:black;">ProductID<br />
GO</span></code></p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/maxdop1.jpg" alt="" width="500" height="269" /></p>
<p style="text-align:justify;">Now the same query can be ran on a single core with the usage of MAXDOP query hint. Let us see the query for the same.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">AdventureWorks<br />
GO<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">*<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">Sales.SalesOrderDetail<br />
</span><span style="color:blue;">ORDER BY </span><span style="color:black;">ProductID<br />
</span><span style="color:blue;">OPTION </span><span style="color:gray;">(</span><span style="color:black;">MAXDOP 1</span><span style="color:gray;">)<br />
</span><span style="color:black;">GO</span></code></p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/maxdop2.jpg" alt="" width="500" height="294" /></p>
<p style="text-align:justify;">Execution plan for the query with query hint of maxdop (1) does not have parallelism operator in it. This way we can remove the parallelism using MAXDOP.</p>
<p style="text-align:justify;">However, before playing with this query hint, please make sure that you check your performance using an execution plan. It is quite possible that the performance of Query with MAXDOP as query hint may be quite degraded when compared to the original performance. You should be very careful with this hint.</p>
<p style="text-align:justify;">Let us compare in our case what is the performance difference between the two above queries. The difference between those two queries is only the query hint of MAXDOP.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/maxdop3.jpg" alt="" width="500" height="466" /></p>
<p style="text-align:justify;">In our example, we got degraded performance as we restricted our query on a single CPU. This is not necessary in the case of all the queries. MAXDOP may improve or reduce performance, test your query out.</p>
<p style="text-align:justify;">I have now one question for all readers. Do you use this query hint? If you do use it, then what is the purpose of the same. Please leave a comment here.</p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/readers-question/'>Readers Question</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/sql-performance/'>SQL Performance</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/tech/sql-scripts/'>SQL Scripts</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/sqlserver/'>SQLServer</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a> Tagged: <a href='http://blog.sqlauthority.com/tag/maxdop/'>MAXDOP</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/8198/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/8198/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/8198/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/8198/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/8198/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/8198/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/8198/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/8198/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/8198/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/8198/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=8198&subd=sqlauthority&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2010/03/15/sql-server-maxdop-settings-to-limit-query-to-run-on-specific-cpu/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/maxdop1.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/maxdop2.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/maxdop3.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Force Index Scan on Table &#8211; Use No Index to Retrieve the Data &#8211; Query Hint</title>
		<link>http://blog.sqlauthority.com/2010/03/11/sql-server-force-index-scan-on-table-use-no-index-to-retrieve-the-data-query-hint/</link>
		<comments>http://blog.sqlauthority.com/2010/03/11/sql-server-force-index-scan-on-table-use-no-index-to-retrieve-the-data-query-hint/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 01:30:40 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Index]]></category>
		<category><![CDATA[SQL Optimization]]></category>
		<category><![CDATA[SQL Performance]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8167</guid>
		<description><![CDATA[Recently I received the following two questions from readers and both the questions have very similar answers.
Question 1: I have a unique requirement where I do not want to use any index of the table; how can I achieve this?
Question 2: Currently my table uses clustered index and does seek operation; how can I convert [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=8167&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Recently I received the following two questions from readers and both the questions have very similar answers.</p>
<p style="text-align:justify;"><strong>Question 1:</strong> I have a unique requirement where I do not want to use any index of the table; how can I achieve this?</p>
<p style="text-align:justify;"><strong>Question 2:</strong> Currently my table uses clustered index and does seek operation; how can I convert seek to scan?</p>
<p style="text-align:justify;">First of all, I am not going to analysis their need of why, in fact, they want to convert seek to scan or use no index here. The requirement is strange as using no index or scanning large table may reduce the performance instead of improving it. We are not going to discuss the &#8216;It Depends&#8217; condition where scan can be better than seek or seek can be better than scan. The User has to take his/her own decision after looking at performance which one is better for its need.</p>
<p style="text-align:justify;">Now, let us see how we can force the use of no index or force a scan operation on clustered index. Scan operation on clustered index is, in fact, scanning the original table. When querying table sys.indexes and closely looking at the column type, it is found to contain various values. Value 0 (Zero) in column type indicates that it is a heap. A heap is defined as a table without index. We will use the value 0 on the table with index to simulate the effect of no index or force index scan where index seek is happening.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/noindex1.jpg" alt="" width="340" height="298" /></p>
<p style="text-align:justify;">If any object has a clustered or nonclustered index on it, it will not have entry of index_id =0. The value 0(Zero) for index_id indicates the heap. You can find further details at <a href="http://msdn.microsoft.com/en-us/library/ms173760.aspx" target="_blank">sys.indexes</a>.</p>
<p style="text-align:justify;">Now, let us run the following query, and please note the usage of the Index hint of INDEX(0), it will force query to not to use any index or behave like a query on heap. The value which is passed to the function INDEX is the value of index_id.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">AdventureWorks<br />
GO<br />
</span><span style="color:blue;">SELECT </span><span style="color:black;">ProductID</span><span style="color:gray;">, </span><span style="color:black;">ProductNumber</span><span style="color:gray;">, </span><span style="color:black;">Color<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">Production.Product<br />
</span><span style="color:blue;">WHERE </span><span style="color:black;">ProductID </span><span style="color:gray;">&lt; </span><span style="color:black;">500<br />
GO<br />
</span><span style="color:blue;">SELECT </span><span style="color:black;">ProductID</span><span style="color:gray;">, </span><span style="color:black;">ProductNumber</span><span style="color:gray;">, </span><span style="color:black;">Color<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">Production.Product </span><span style="color:blue;">WITH </span><span style="color:gray;">(</span><span style="color:blue;">INDEX</span><span style="color:gray;">(</span><span style="color:black;">0</span><span style="color:gray;">))<br />
</span><span style="color:blue;">WHERE </span><span style="color:black;">ProductID </span><span style="color:gray;">&lt; </span><span style="color:black;">500<br />
GO</span></code></p>
<p style="text-align:justify;">Let us check the execution plan for this query batch, and we should able to see in the second query that the seek is converted to scan. This answers the question of how to convert seek to scan?</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/noindex.jpg" alt="" width="500" height="601" /></p>
<p style="text-align:justify;">Now, once again, let us run the following similar query, where we can see how INDEX(0) is behaving.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">AdventureWorks<br />
GO<br />
</span><span style="color:blue;">SELECT </span><span style="color:black;">ProductID</span><span style="color:gray;">, </span><span style="color:black;">ProductNumber<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">Production.Product<br />
</span><span style="color:blue;">WHERE </span><span style="color:black;">ProductNumber </span><span style="color:blue;">= </span><span style="color:red;">'CR-7833'<br />
</span><span style="color:black;">GO<br />
</span><span style="color:blue;">SELECT </span><span style="color:black;">ProductID</span><span style="color:gray;">, </span><span style="color:black;">ProductNumber<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">Production.Product </span><span style="color:blue;">WITH </span><span style="color:gray;">(</span><span style="color:blue;">INDEX</span><span style="color:gray;">(</span><span style="color:black;">0</span><span style="color:gray;">))<br />
</span><span style="color:blue;">WHERE </span><span style="color:black;">ProductNumber </span><span style="color:blue;">= </span><span style="color:red;">'CR-7833'<br />
</span><span style="color:black;">GO</span></code></p>
<p style="text-align:justify;">It is clear from result that original index usage is replaced with Clustered Index Scan. Also, from the first example, we have seen that how it is forcing scan even though seek is possible. Well, this indicates that the basic index was not used. I would rather say that we get a result that is same as the result when there is no index on the table.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/noindex2.jpg" alt="" width="500" height="558" /></p>
<p style="text-align:justify;">The strong argument here is that even though you use Index(0) or Index(1) in this later example, there is no difference in the result. The logical reasoning we can reach after considering the first example is that if the use of Index(1) was forcing index seek due to any reason, using Index(0) will eliminate the seek part and clustered index will be scanned just like it would have happened in the case of Heap. If table has clustered index, it is ordered in a certain way and it cannot be used like heap after having clustered index on it; however just like heap, the scan is pushed over it.</p>
<p style="text-align:justify;">I want to know if community had ever faced the above two questions and also your take on these. Moreover, I have a gut feeling that there is something missing in the above explanation, and I request you all to help me complete the explanation.</p>
<p style="text-align:justify;">Reference: <strong>Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/readers-question/'>Readers Question</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/sql-index/'>SQL Index</a>, <a href='http://blog.sqlauthority.com/category/sql-optimization/'>SQL Optimization</a>, <a href='http://blog.sqlauthority.com/category/sql-performance/'>SQL Performance</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/tech/sql-scripts/'>SQL Scripts</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/8167/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/8167/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/8167/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/8167/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/8167/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/8167/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/8167/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/8167/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/8167/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/8167/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=8167&subd=sqlauthority&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2010/03/11/sql-server-force-index-scan-on-table-use-no-index-to-retrieve-the-data-query-hint/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/noindex1.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/noindex.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/noindex2.jpg" medium="image" />
	</item>
		<item>
		<title>SQLAuthority News &#8211; SQL SERVER 2008 R2 Pricing</title>
		<link>http://blog.sqlauthority.com/2010/03/08/sql-server-2008-r2-pricing/</link>
		<comments>http://blog.sqlauthority.com/2010/03/08/sql-server-2008-r2-pricing/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 01:30:39 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Add-On]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQLAuthority News]]></category>
		<category><![CDATA[SQLAuthority Website Review]]></category>
		<category><![CDATA[SQLServer]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Pricing]]></category>
		<category><![CDATA[SQL Server 2008 R2]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8119</guid>
		<description><![CDATA[I was recently asked question about SQL Server 2008 pricing. I have bookmarked official site here which lists the pricing.
Official site: What&#8217;s New in SQL Server 2008 R2 Editions



Editions
Per Processor PricingRetail

Per Server Plus CAL PricingRetail



Parallel Data Warehouse
$57,498
Not offered via Server CAL


Datacenter 
$57,498
Not offered via Server CAL


Enterprise
$28,749
$13,969 with 25 CALs


Standard 
$7,499
$1,849 with 5 CALs



However, I have [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=8119&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">I was recently asked question about SQL Server 2008 pricing. I have bookmarked official site here which lists the pricing.</p>
<p style="text-align:justify;">Official site: <a href="http://www.microsoft.com/sqlserver/2008/en/us/R2-editions.aspx" target="_blank">What&#8217;s New in SQL Server 2008 R2 Editions</a></p>
<table style="height:108px;text-align:justify;" border="1" width="500px;">
<tbody>
<tr>
<th><strong>Editions</strong></th>
<th><strong>Per Processor Pricing</strong><strong>Retail<br />
</strong></th>
<th><strong>Per Server Plus CAL Pricing</strong><strong>Retail<br />
</strong></th>
</tr>
<tr>
<td><strong>Parallel Data Warehouse</strong></td>
<td>$57,498</td>
<td>Not offered via Server CAL</td>
</tr>
<tr>
<td><strong>Datacenter </strong></td>
<td>$57,498</td>
<td>Not offered via Server CAL</td>
</tr>
<tr>
<td><strong>Enterprise</strong></td>
<td>$28,749</td>
<td>$13,969 with 25 CALs</td>
</tr>
<tr>
<td><strong>Standard </strong></td>
<td>$7,499</td>
<td>$1,849 with 5 CALs</td>
</tr>
</tbody>
</table>
<p style="text-align:justify;">However, I have bookmarked following site of <em><strong>Brent Ozar</strong></em> <a href="http://www.brentozar.com/archive/2009/11/sql-server-2008-r2-pricing-and-feature-changes/" target="_blank">SQL Server 2008 R2 Pricing and Feature Changes</a>. I think Brent has answered one very interesting question there that SQL Server R2 is FREE for only who has purchased software assurance.</p>
<p style="text-align:justify;">I really would like to know if your organization is upgrading to SQL Server 2008 R2. Please leave your comment here.</p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/readers-question/'>Readers Question</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/sql-add-on/'>SQL Add-On</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/sqlauthority/sqlauthority-news/'>SQLAuthority News</a>, <a href='http://blog.sqlauthority.com/category/sqlauthority/sqlauthority-website-review/'>SQLAuthority Website Review</a>, <a href='http://blog.sqlauthority.com/category/sqlserver/'>SQLServer</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a> Tagged: <a href='http://blog.sqlauthority.com/tag/pricing/'>Pricing</a>, <a href='http://blog.sqlauthority.com/tag/sql-server-2008-r2/'>SQL Server 2008 R2</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/8119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/8119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/8119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/8119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/8119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/8119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/8119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/8119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/8119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/8119/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=8119&subd=sqlauthority&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2010/03/08/sql-server-2008-r2-pricing/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER- IF EXISTS(Select null from table) vs IF EXISTS(Select 1 from table)</title>
		<link>http://blog.sqlauthority.com/2010/02/21/sql-server-if-existsselect-null-from-table-vs-if-existsselect-1-from-table/</link>
		<comments>http://blog.sqlauthority.com/2010/02/21/sql-server-if-existsselect-null-from-table-vs-if-existsselect-1-from-table/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 01:30:43 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Contribution]]></category>
		<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Optimization]]></category>
		<category><![CDATA[SQL Performance]]></category>
		<category><![CDATA[SQL Puzzle]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQLServer]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8029</guid>
		<description><![CDATA[Few days ago I wrote article about SQL SERVER – Stored Procedure Optimization Tips – Best Practices. I received lots of comments on particular blog article. In fact, almost all the comments are very interesting. If you have not read all the comments, I strongly suggest to read them. Click here to read the comments.
The [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=8029&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Few days ago I wrote article about <strong><a href="http://blog.sqlauthority.com/2010/02/16/sql-server-stored-procedure-optimization-tips-best-practices/" target="_blank">SQL SERVER – Stored Procedure Optimization Tips – Best Practices</a></strong>. I received lots of comments on particular blog article. In fact, almost all the comments are very interesting. If you have not read all the comments, I strongly suggest to read them. Click here to read the comments.</p>
<p style="text-align:justify;">The most interesting comment conversation is among Divya, Brian and Marko. Please read the comments of Marko for sure. It is the comment, which has triggered this post.</p>
<p style="text-align:justify;"><strong><a href="http://blog.sqlauthority.com/2010/02/16/sql-server-stored-procedure-optimization-tips-best-practices/#comment-61425" target="_blank">Comments by Divya</a></strong></p>
<p style="padding-left:30px;text-align:justify;">I have seen in one of the blogs to use EXISTS like</p>
<p style="padding-left:30px;text-align:justify;">IF EXISTS(Select null from table)</p>
<p style="padding-left:30px;text-align:justify;">Will it optimize the perfomance better than</p>
<p style="padding-left:30px;text-align:justify;">IF EXISTS(Select 1 from table)?</p>
<p style="text-align:justify;"><strong><a href="http://blog.sqlauthority.com/2010/02/16/sql-server-stored-procedure-optimization-tips-best-practices/#comment-61482" target="_blank">Comments by Brian Tkatch</a></strong></p>
<p style="text-align:justify;">@Divya</p>
<p style="padding-left:30px;text-align:justify;">It makes no difference what is put there.</p>
<p style="padding-left:30px;text-align:justify;">Brad Schulz has an interest article on it: http://bradsruminations.blogspot.com/2009/09/age-old-select-vs-select-1-debate.html</p>
<p style="padding-left:30px;text-align:justify;">Even 1/0 is allowed! Obviously, it is not evaluated.</p>
<p style="padding-left:30px;text-align:justify;">Technically, however, * does get expanded, adding some minuscule amount of time: http://www.sqlskills.com/BLOGS/CONOR/2008/02/default.aspx?page=2</p>
<p style="padding-left:30px;text-align:justify;">So, anything other than * takes the same amount of time. * takes an iota longer. Personally, i use *, to show that i do not care what the results are.</p>
<p style="text-align:justify;"><strong><a href="http://blog.sqlauthority.com/2010/02/16/sql-server-stored-procedure-optimization-tips-best-practices/#comment-61485" target="_blank">Comments by Pinal Dave</a></strong></p>
<p style="padding-left:30px;text-align:justify;">Hello Divya,</p>
<p style="padding-left:30px;text-align:justify;">I not think so because there is no significant difference in transferring of 1 byte and a null value.</p>
<p style="padding-left:30px;text-align:justify;">Other than that there is no difference between these two queries.</p>
<p style="padding-left:30px;text-align:justify;">Regards,</p>
<p style="padding-left:30px;text-align:justify;">Pinal Dave</p>
<p style="text-align:justify;"><strong><a href="http://blog.sqlauthority.com/2010/02/16/sql-server-stored-procedure-optimization-tips-best-practices/#comment-61502" target="_blank">Comments by Marko Parkkola</a></strong></p>
<p style="padding-left:30px;text-align:justify;">“I not think so because there is no significant difference in transferring of 1 byte and a null value.”</p>
<p style="padding-left:30px;text-align:justify;">While that is true in this exact case I like to be pedantic about this and elaborate this a bit and probably confuse everybody up :)</p>
<p style="padding-left:30px;text-align:justify;">There is no concept NULL value if you think about C code or even the CPU. Pointers in C can have NULL values but that just means that the pointer is pointing to memory in the address 0×00000000 (in 32-bit machine). The actual pointer is still taking sizeof(VOID*) amount of memory even when it points to NULL.</p>
<p style="padding-left:30px;text-align:justify;">Now if you think about functions in C or any other language they always reserve space in the function stack for the return value. You can say, again in C, that you don’t care about the return value and declare the function to return “void” but still it takes 4 bytes of memory in 32-bit machine for return value.</p>
<p style="padding-left:30px;text-align:justify;">And actually, of you think about the CPU, there is 32 bit register reserved exactly for this.</p>
<p style="padding-left:30px;text-align:justify;">And now considering that it makes no difference to return one byte or four bytes since there is space for four bytes anyway. And in fact, many times (all the times?) when you deal with C data types CHAR (1 byte) or SHORT (2 bytes) you end up taking 4 bytes because of the padding to keep memory aligned.</p>
<p style="padding-left:30px;text-align:justify;"><span style="color:#333399;"><em><strong>Uh! I almost felt like going back in time some ten years when I was writing kernel drivers for Windows :)</strong></em></span></p>
<p style="text-align:justify;">This is excellent participation from experts like Marko and Brian. I really like the last line of Marko where it mentioned kernel drivers of Windows. Bravo everybody!</p>
<p style="text-align:justify;">If you have any suggestion please leave a comment in original article.</p>
<p style="text-align:justify;">Reference: <strong>Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/best-practices/'>Best Practices</a>, <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/readers-contribution/'>Readers Contribution</a>, <a href='http://blog.sqlauthority.com/category/readers-question/'>Readers Question</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/sql-optimization/'>SQL Optimization</a>, <a href='http://blog.sqlauthority.com/category/sql-performance/'>SQL Performance</a>, <a href='http://blog.sqlauthority.com/category/sql-puzzle/'>SQL Puzzle</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/tech/sql-scripts/'>SQL Scripts</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/sqlserver/'>SQLServer</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/8029/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/8029/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/8029/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/8029/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/8029/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/8029/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/8029/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/8029/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/8029/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/8029/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=8029&subd=sqlauthority&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2010/02/21/sql-server-if-existsselect-null-from-table-vs-if-existsselect-1-from-table/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER &#8211; Get the List of Object Dependencies &#8211; sp_depends and information_schema.routines and sys.dm_sql_referencing_entities</title>
		<link>http://blog.sqlauthority.com/2010/02/04/sql-server-get-the-list-of-object-dependencies-sp_depends-and-information_schema-routines-and-sys-dm_sql_referencing_entities/</link>
		<comments>http://blog.sqlauthority.com/2010/02/04/sql-server-get-the-list-of-object-dependencies-sp_depends-and-information_schema-routines-and-sys-dm_sql_referencing_entities/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 01:30:43 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL System Table]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQLServer]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7890</guid>
		<description><![CDATA[Recently, I read a question on my friend Ritesh Shah&#8217;s SQL site regarding the following: sp_depends does not give appropriate results whereas information_schema.routines does give proper answer.
I have quite often seen that information_schema.routines gives proper dependency relationship where assp_depends returns an incorrect answer. However, as per book online sp_depends will be deprecated, and instead, sys.dm_sql_referencing_entities [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=7890&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Recently, I read a question on my friend <a href="http://www.sqlhub.com/2010/01/spdepends-is-very-useful-stored.html" target="_blank">Ritesh Shah</a>&#8217;s SQL site regarding the following: sp_depends does not give appropriate results whereas information_schema.routines does give proper answer.</p>
<p style="text-align:justify;">I have quite often seen that information_schema.routines gives proper dependency relationship where assp_depends returns an incorrect answer. However, as per book online sp_depends will be deprecated, and instead, sys.dm_sql_referencing_entities and sys.dm_sql_referenced_entities are recommended.</p>
<p style="text-align:justify;">Let us quickly see where sp_depends fail and other solutions work fine.</p>
<p style="text-align:justify;">Let us first create two scenarios.</p>
<p style="text-align:justify;"><strong>Scenario 1: Normal Table Creation Order, where objects are created first and then used afterwords.</strong></p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">TempDB<br />
GO<br />
</span><span style="color:blue;">CREATE TABLE </span><span style="color:black;">dbo.TestTable<br />
</span><span style="color:gray;">( </span><span style="color:black;">ID </span><span style="color:blue;">INT</span><span style="color:gray;">,<br />
</span><span style="color:black;">Name </span><span style="color:blue;">VARCHAR</span><span style="color:gray;">(</span><span style="color:black;">100</span><span style="color:gray;">))<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- dbo.First is not created yet<br />
</span><span style="color:blue;">CREATE PROCEDURE </span><span style="color:black;">dbo.Second<br />
</span><span style="color:blue;">AS<br />
EXEC </span><span style="color:black;">dbo.First<br />
GO<br />
</span><span style="color:blue;">CREATE PROCEDURE </span><span style="color:black;">dbo.First<br />
</span><span style="color:blue;">AS<br />
SELECT </span><span style="color:black;">ID</span><span style="color:gray;">, </span><span style="color:black;">Name<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">TestTable<br />
GO<br />
</span></code></p>
<p style="text-align:justify;"><strong>Scenario 2: Objects are created afterwords and they are referenced first.</strong></p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">TempDB<br />
GO<br />
</span><span style="color:blue;">CREATE TABLE </span><span style="color:black;">dbo.TestTable<br />
</span><span style="color:gray;">( </span><span style="color:black;">ID </span><span style="color:blue;">INT</span><span style="color:gray;">,<br />
</span><span style="color:black;">Name </span><span style="color:blue;">VARCHAR</span><span style="color:gray;">(</span><span style="color:black;">100</span><span style="color:gray;">))<br />
</span><span style="color:black;">GO<br />
</span><span style="color:blue;">CREATE PROCEDURE </span><span style="color:black;">dbo.First<br />
</span><span style="color:blue;">AS<br />
SELECT </span><span style="color:black;">ID</span><span style="color:gray;">, </span><span style="color:black;">Name<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">TestTable<br />
GO<br />
</span><span style="color:green;">-- dbo.First is already created<br />
</span><span style="color:blue;">CREATE PROCEDURE </span><span style="color:black;">dbo.Second<br />
</span><span style="color:blue;">AS<br />
EXEC </span><span style="color:black;">dbo.First<br />
GO</span></code></p>
<p style="text-align:justify;">Now let us run following three queries on both the scenarios.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:green;">-- Method 1: Using sp_depends<br />
</span><span style="color:darkred;">sp_depends </span><span style="color:red;">'dbo.First'<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Method 2: Using information_schema.routines<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">*<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">information_schema.routines ISR<br />
</span><span style="color:blue;">WHERE CHARINDEX</span><span style="color:gray;">(</span><span style="color:red;">'dbo.First'</span><span style="color:gray;">, </span><span style="color:black;">ISR.ROUTINE_DEFINITION</span><span style="color:gray;">) &gt; </span><span style="color:black;">0<br />
GO<br />
</span><span style="color:green;">-- Method 3: Using DMV sys.dm_sql_referencing_entities<br />
</span><span style="color:blue;">SELECT </span><span style="color:black;">referencing_schema_name</span><span style="color:gray;">, </span><span style="color:black;">referencing_entity_name</span><span style="color:gray;">,<br />
</span><span style="color:black;">referencing_id</span><span style="color:gray;">, </span><span style="color:black;">referencing_class_desc</span><span style="color:gray;">, </span><span style="color:black;">is_caller_dependent<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">sys.dm_sql_referencing_entities </span><span style="color:gray;">(</span><span style="color:red;">'dbo.First'</span><span style="color:gray;">, </span><span style="color:red;">'OBJECT'</span><span style="color:gray;">);<br />
</span><span style="color:black;">GO</span></code></p>
<p style="text-align:justify;"><strong>Result from Scenario 1</strong></p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/sp_depends1.jpg" alt="" width="500" height="410" /></p>
<p style="text-align:justify;"><strong>Result from Scenario 2</strong></p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/sp_depends2.jpg" alt="" width="500" height="393" /></p>
<p style="text-align:justify;">It is clear that sp_depends does not give proper/correct results when the object creation order is different or following deferred name resolution.</p>
<p style="text-align:justify;">I suggest the use of the third method, in which sys.dm_sql_referencing_entities is used.</p>
<p style="text-align:justify;">Use the following script to get correct dependency:</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">SELECT </span><span style="color:black;">referencing_schema_name</span><span style="color:gray;">, </span><span style="color:black;">referencing_entity_name</span><span style="color:gray;">,<br />
</span><span style="color:black;">referencing_id</span><span style="color:gray;">, </span><span style="color:black;">referencing_class_desc</span><span style="color:gray;">, </span><span style="color:black;">is_caller_dependent<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">sys.dm_sql_referencing_entities </span><span style="color:gray;">(</span><span style="color:red;">'YourObject'</span><span style="color:gray;">, </span><span style="color:red;">'OBJECT'</span><span style="color:gray;">);<br />
</span><span style="color:black;">GO</span></code></p>
<p style="text-align:justify;">Let me know the type of scripts you use for finding Object Dependencies. I will post your script with due credit.</p>
<p style="text-align:justify;">Reference: <strong>Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/readers-question/'>Readers Question</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/tech/sql-scripts/'>SQL Scripts</a>, <a href='http://blog.sqlauthority.com/category/sql-security/'>SQL Security</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/sql-system-table/'>SQL System Table</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/sqlserver/'>SQLServer</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/7890/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/7890/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/7890/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/7890/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/7890/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/7890/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/7890/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/7890/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/7890/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/7890/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=7890&subd=sqlauthority&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2010/02/04/sql-server-get-the-list-of-object-dependencies-sp_depends-and-information_schema-routines-and-sys-dm_sql_referencing_entities/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/sp_depends1.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/sp_depends2.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Question &#8211; How to Convert Hex to Decimal</title>
		<link>http://blog.sqlauthority.com/2010/02/01/sql-server-question-how-to-convert-hex-to-decimal/</link>
		<comments>http://blog.sqlauthority.com/2010/02/01/sql-server-question-how-to-convert-hex-to-decimal/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 01:30:06 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Puzzle]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQLServer]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7785</guid>
		<description><![CDATA[In one of the recent projects, I realize the bottleneck of the query was an inline function which was converting Hex to Decimal. I optimized the inline function and reduced the query running time to one-tenth of the original running time. Later, I was eager to find out the script my blog readers might be [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=7785&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">In one of the recent projects, I realize the bottleneck of the query was an inline function which was converting Hex to Decimal. I optimized the inline function and reduced the query running time to one-tenth of the original running time. Later, I was eager to find out the script my blog readers might be using for hex to decimal conversion. Please leave your comments here and I will consider all the valid answers and publish with <strong><em>due credit </em></strong>to the author in one of the future posts. If the script you have posted here is not your original script, I suggest that you include the source as well.</p>
<p style="text-align:justify;">Reference: <strong>Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/readers-question/'>Readers Question</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/sql-puzzle/'>SQL Puzzle</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/sqlserver/'>SQLServer</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/7785/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/7785/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/7785/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/7785/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/7785/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/7785/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/7785/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/7785/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/7785/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/7785/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=7785&subd=sqlauthority&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2010/02/01/sql-server-question-how-to-convert-hex-to-decimal/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER &#8211; Several Readers Questions and Readers Answers</title>
		<link>http://blog.sqlauthority.com/2010/01/30/sql-server-several-readers-questions-and-readers-answers/</link>
		<comments>http://blog.sqlauthority.com/2010/01/30/sql-server-several-readers-questions-and-readers-answers/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 01:30:50 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Contribution]]></category>
		<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQLServer]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7847</guid>
		<description><![CDATA[I often get questions on blog and many times I even get answers from readers as well. This article is collection of few of the questions and answers by readers of this blog.
Q. How the records of a table can be scripted in INSERT INTO statements?
A. In SQL Server 2008 : Right click Database &#62; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=7847&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">I often get questions on blog and many times I even get answers from readers as well. This article is collection of few of the questions and answers by readers of this blog.</p>
<p style="text-align:justify;"><strong>Q. How the records of a table can be scripted in INSERT INTO statements?</strong></p>
<p style="text-align:justify;">A. In SQL Server 2008 : Right click Database &gt; Tasks &gt; Generate Scripts &gt; In the wizard on Choose Script Option page, set Script Data option to True and complete the wizard.For SQL 2005 or earlier versions, use Database Publishing Wizard. For more details about Database Publishing wizard, please visit the blog <a href="http://blog.sqlauthority.com/2007/11/16/sql-server-2005-generate-script-with-data-from-database-database-publishing-wizard/" target="_blank">http://blog.sqlauthority.com/2007/11/16/sql-server-2005-generate-script-with-data-from-database-database-publishing-wizard/</a></p>
<p style="text-align:justify;"><strong>Q. How can I track the changes or identify the latest insert-update-delete from a table?</strong></p>
<p style="text-align:justify;">A. In SQL Server 2005 and earlier versions, there is no inbuilt functionality to know which row was recently changed and what were the changes. However, in SQL Server 2008, a new feature known as Change Data Capture (CDC) has been introduced to capture the changed data. To get more details about CDC, please visit <a href="http://blog.sqlauthority.com/2009/08/15/sql-server-introduction-to-change-data-capture-cdc-in-sql-server-2008/">http://blog.sqlauthority.com/2009/08/15/sql-server-introduction-to-change-data-capture-cdc-in-sql-server-2008/</a></p>
<p style="text-align:justify;">In versions prior to 2008, the best method to track changes at the table level is Triggers and at the database level is SQL Profiler. Another workaround is to add one more column in the table like “ModifiedDate” to keep the current date-time of the change. Timestamp, rowversion and checksum columns are for optimistic concurrency. These are not suitable to track changes later.</p>
<p style="text-align:justify;"><strong>Q. I am getting collation conflict error when joining columns of two tables?</strong></p>
<p style="text-align:justify;">A. When we try to compare, join or union two columns of different collations, the following error occurs: <em>“Cannot resolve the collation conflict for equal to operation”.</em></p>
<p style="text-align:justify;">Collation represents the character set of a data and can be specified at server, database and column levels. Collation of server is default for databases and collation of database is default for all columns. The collation is matched in following cases while executing a SELECT statement:</p>
<p style="text-align:justify;">SELECT col1, col2<br />
FROM Table1.col1 = Table2.col4<br />
UNION<br />
SELECT col5, col6<br />
FROM Table3</p>
<p style="text-align:justify;">Here make sure that collation of following columns should match<br />
col1 = col5<br />
col1 = col4<br />
col2 = col6</p>
<p style="text-align:justify;">To resolve this issue, you can either specify collation with column name in t-sql statement or change the collation of column permanently by altering the table, database or even server. For more details on how to specify collation in t-sql statement, please check following article: <a href="http://blog.sqlauthority.com/2007/06/11/sql-server-cannot-resolve-collation-conflict-for-equal-to-operation/">http://blog.sqlauthority.com/2007/06/11/sql-server-cannot-resolve-collation-conflict-for-equal-to-operation/</a></p>
<p style="text-align:justify;">Sometimes, this error occurs while comparing the table with temporary tables. In this case, check the default collation of your working database and tempdb. If they do not match, then apply the above mentioned resolution.</p>
<p style="text-align:justify;"><strong>Q. How can I get data from a database on another server?</strong></p>
<p style="text-align:justify;">A. If you want to import data only through t-sql query, then either use OPENDATASOURCE function. To repeatedly get data from another server, create a linked server and then use OPENQUERY function or use 4 part naming. If you are not adhered with T-SQL, then better use import/export wizard, and you can save it as a SSIS package for future use.</p>
<p style="text-align:justify;"><strong>Q. My multilanguage data is not inserting correctly and returning as ???. How can I store Multilanguage data in a table?</strong></p>
<p style="text-align:justify;">A. There are two things to keep in mind while storing unicode data. First, the column must be of unicode data type (nchar, nvarchar, ntext). Second, the value must be prefixed with N while insertion. For example,</p>
<p style="text-align:justify;">INSERT INTO table (Hindi_col) values (N’hindi data’)</p>
<p style="text-align:justify;">I will post the second series of readers&#8217; question and answers in future posts.</p>
<p style="text-align:justify;">Reference: <strong>Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/readers-contribution/'>Readers Contribution</a>, <a href='http://blog.sqlauthority.com/category/readers-question/'>Readers Question</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/tech/sql-scripts/'>SQL Scripts</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/sqlserver/'>SQLServer</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/7847/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/7847/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/7847/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/7847/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/7847/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/7847/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/7847/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/7847/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/7847/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/7847/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=7847&subd=sqlauthority&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2010/01/30/sql-server-several-readers-questions-and-readers-answers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER &#8211; Size of Index Table for Each Index &#8211; Solution</title>
		<link>http://blog.sqlauthority.com/2009/11/30/sql-server-size-of-index-table-for-each-index-solution/</link>
		<comments>http://blog.sqlauthority.com/2009/11/30/sql-server-size-of-index-table-for-each-index-solution/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 01:30:10 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Contribution]]></category>
		<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Index]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7444</guid>
		<description><![CDATA[Earlier I have posted small question on this blog and requested help from readers to participate here and provide solution. Please read the original Puzzle here.
SQL SERVER – Size of Index Table – A Puzzle to Find Index Size for Each Index on Table
The puzzle was to write a query that will return the size [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=7444&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Earlier I have posted small question on this blog and requested help from readers to participate here and provide solution. Please read the original Puzzle here.</p>
<p style="text-align:justify;"><strong><a href="http://blog.sqlauthority.com/2009/11/18/sql-server-size-of-index-table-a-puzzle-to-find-index-size-for-each-index-on-table/" target="_blank">SQL SERVER – Size of Index Table – A Puzzle to Find Index Size for Each Index on Table</a></strong></p>
<p style="text-align:justify;">The puzzle was to write a query that will return the size for each index that is on any particular table. We need a query that will return an additional column in the above listed query and it should contain the size of the index.</p>
<p style="text-align:justify;">So far I have found two potential solutions. I have done some good amount of testing of both the script and they both are really giving accurate results 99.9% of the time. There were couple of instances where it provided incorrect results but for the most of the time, it just worked like charm. Again, it may be a bit of rounding up logic and I will not hold it against the script.</p>
<p style="text-align:justify;">I want to thank <a href="http://fun-with-blackhawk.blogspot.com/" target="_blank">Gaurav Sharama</a> and <a href="http://adamhutson.com/post/Puzzle-Solved.aspx" target="_blank">Adam Hutson</a> for their participation.</p>
<p style="text-align:justify;">Solution from <strong><a href="http://blog.sqlauthority.com/2009/11/18/sql-server-size-of-index-table-a-puzzle-to-find-index-size-for-each-index-on-table/#comment-57685" target="_blank">Gaurav Sharma</a></strong></p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">DECLARE </span><span style="color:#434343;">@OBJECT_NAME </span><span style="color:blue;">VARCHAR</span><span style="color:gray;">(</span><span style="color:black;">255</span><span style="color:gray;">) </span><span style="color:blue;">= </span><span style="color:red;">'HumanResources.Shift'</span><span style="color:gray;">;<br />
</span><span style="color:blue;">DECLARE </span><span style="color:#434343;">@temp </span><span style="color:blue;">TABLE<br />
</span><span style="color:gray;">(<br />
</span><span style="color:black;">indexID  BIGINT</span><span style="color:gray;">,<br />
</span><span style="color:black;">objectId  BIGINT</span><span style="color:gray;">,<br />
</span><span style="color:black;">index_name </span><span style="color:blue;">NVARCHAR</span><span style="color:gray;">(</span><span style="color:blue;">MAX</span><span style="color:gray;">),<br />
</span><span style="color:black;">used_page_count  BIGINT</span><span style="color:gray;">,<br />
</span><span style="color:black;">pages  BIGINT<br />
</span><span style="color:gray;">)<br />
</span><span style="color:green;">--Insert into temp table<br />
</span><span style="color:blue;">INSERT INTO </span><span style="color:#434343;">@temp<br />
</span><span style="color:blue;">SELECT<br />
</span><span style="color:black;">P.index_id</span><span style="color:gray;">,<br />
</span><span style="color:black;">P.</span><span style="color:magenta;">OBJECT_ID </span><span style="color:gray;">,<br />
</span><span style="color:black;">I.name</span><span style="color:gray;">,<br />
</span><span style="color:magenta;">SUM </span><span style="color:gray;">(</span><span style="color:black;">used_page_count</span><span style="color:gray;">),<br />
</span><span style="color:magenta;">SUM </span><span style="color:gray;">(<br />
</span><span style="color:magenta;">CASE<br />
</span><span style="color:blue;">WHEN </span><span style="color:gray;">(</span><span style="color:black;">p.index_id </span><span style="color:gray;">&lt; </span><span style="color:black;">2</span><span style="color:gray;">) </span><span style="color:blue;">THEN </span><span style="color:gray;">(</span><span style="color:black;">in_row_data_page_count </span><span style="color:gray;">+ </span><span style="color:black;">lob_used_page_count </span><span style="color:gray;">+ </span><span style="color:black;">row_overflow_used_page_count</span><span style="color:gray;">)<br />
</span><span style="color:blue;">ELSE </span><span style="color:black;">lob_used_page_count </span><span style="color:gray;">+ </span><span style="color:black;">row_overflow_used_page_count<br />
</span><span style="color:blue;">END<br />
</span><span style="color:gray;">)<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">sys.dm_db_partition_stats P </span><span style="color:blue;">INNER JOIN </span><span style="color:black;">sys.indexes I </span><span style="color:blue;">ON </span><span style="color:black;">I.index_id </span><span style="color:blue;">= </span><span style="color:black;">P.index_id </span><span style="color:gray;">AND </span><span style="color:black;">I.</span><span style="color:magenta;">OBJECT_ID </span><span style="color:blue;">= </span><span style="color:black;">P.</span><span style="color:magenta;">OBJECT_ID<br />
</span><span style="color:blue;">WHERE </span><span style="color:black;">p.</span><span style="color:magenta;">OBJECT_ID </span><span style="color:blue;">= </span><span style="color:magenta;">OBJECT_ID</span><span style="color:gray;">(</span><span style="color:#434343;">@OBJECT_NAME</span><span style="color:gray;">)<br />
</span><span style="color:blue;">GROUP BY </span><span style="color:black;">P.index_id</span><span style="color:gray;">, </span><span style="color:black;">I.Name</span><span style="color:gray;">, </span><span style="color:black;">P.</span><span style="color:magenta;">OBJECT_ID</span><span style="color:gray;">;<br />
</span><span style="color:blue;">SELECT </span><span style="color:black;">index_name INDEX_NAME</span><span style="color:gray;">,<br />
</span><span style="color:magenta;">LTRIM </span><span style="color:gray;">(</span><span style="color:magenta;">STR </span><span style="color:gray;">((</span><span style="color:magenta;">CASE </span><span style="color:blue;">WHEN </span><span style="color:black;">used_page_count </span><span style="color:gray;">&gt; </span><span style="color:black;">pages </span><span style="color:blue;">THEN </span><span style="color:gray;">(</span><span style="color:black;">used_page_count </span><span style="color:gray;">- </span><span style="color:black;">pages</span><span style="color:gray;">) </span><span style="color:blue;">ELSE </span><span style="color:black;">0 </span><span style="color:blue;">END</span><span style="color:gray;">) * </span><span style="color:black;">8</span><span style="color:gray;">, </span><span style="color:black;">15</span><span style="color:gray;">, </span><span style="color:black;">0</span><span style="color:gray;">) + </span><span style="color:red;">' KB'</span><span style="color:gray;">) </span><span style="color:black;">INDEX_SIZE<br />
</span><span style="color:blue;">FROM </span><span style="color:#434343;">@temp </span><span style="color:black;">T<br />
GO</span></code></p>
<p style="text-align:justify;">Solution from <strong><a href="http://blog.sqlauthority.com/2009/11/18/sql-server-size-of-index-table-a-puzzle-to-find-index-size-for-each-index-on-table/#comment-57774" target="_blank">Adam Hutson</a></strong></p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">DECLARE<br />
</span><span style="color:#434343;">@objname </span><span style="color:blue;">NVARCHAR</span><span style="color:gray;">(</span><span style="color:black;">776</span><span style="color:gray;">),<br />
</span><span style="color:#434343;">@id </span><span style="color:blue;">INT</span><span style="color:gray;">,<br />
</span><span style="color:#434343;">@dbname </span><span style="color:black;">sysname<br />
</span><span style="color:blue;">SELECT<br />
</span><span style="color:#434343;">@objname </span><span style="color:blue;">= </span><span style="color:red;">'HumanResources.Shift'</span><span style="color:gray;">,<br />
</span><span style="color:#434343;">@dbname </span><span style="color:blue;">= </span><span style="color:magenta;">ISNULL</span><span style="color:gray;">(</span><span style="color:magenta;">PARSENAME</span><span style="color:gray;">(</span><span style="color:#434343;">@objname</span><span style="color:gray;">, </span><span style="color:black;">3</span><span style="color:gray;">),</span><span style="color:magenta;">DB_NAME</span><span style="color:gray;">()),<br />
</span><span style="color:#434343;">@id </span><span style="color:blue;">= </span><span style="color:magenta;">OBJECT_ID</span><span style="color:gray;">(</span><span style="color:#434343;">@objname</span><span style="color:gray;">)<br />
</span><span style="color:blue;">SELECT<br />
</span><span style="color:black;">i.</span><span style="color:gray;">*,<br />
</span><span style="color:magenta;">CASE<br />
</span><span style="color:blue;">WHEN </span><span style="color:black;">ps.usedpages </span><span style="color:gray;">&gt; </span><span style="color:black;">ps.pages </span><span style="color:blue;">THEN </span><span style="color:gray;">(</span><span style="color:black;">ps.usedpages </span><span style="color:gray;">- </span><span style="color:black;">ps.pages</span><span style="color:gray;">)<br />
</span><span style="color:blue;">ELSE </span><span style="color:black;">0<br />
</span><span style="color:blue;">END </span><span style="color:gray;">* </span><span style="color:black;">8 indexsize<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">sys.indexes i<br />
</span><span style="color:blue;">INNER JOIN </span><span style="color:gray;">(<br />
</span><span style="color:blue;">SELECT<br />
</span><span style="color:magenta;">OBJECT_ID</span><span style="color:gray;">,<br />
</span><span style="color:black;">index_id</span><span style="color:gray;">,<br />
</span><span style="color:magenta;">SUM </span><span style="color:gray;">(</span><span style="color:black;">used_page_count</span><span style="color:gray;">) </span><span style="color:black;">usedpages</span><span style="color:gray;">,<br />
</span><span style="color:magenta;">SUM </span><span style="color:gray;">(<br />
</span><span style="color:magenta;">CASE<br />
</span><span style="color:blue;">WHEN </span><span style="color:gray;">(</span><span style="color:black;">index_id </span><span style="color:gray;">&lt; </span><span style="color:black;">2</span><span style="color:gray;">) </span><span style="color:blue;">THEN </span><span style="color:gray;">(</span><span style="color:black;">in_row_data_page_count </span><span style="color:gray;">+ </span><span style="color:black;">lob_used_page_count </span><span style="color:gray;">+ </span><span style="color:black;">row_overflow_used_page_count</span><span style="color:gray;">)<br />
</span><span style="color:blue;">ELSE </span><span style="color:black;">lob_used_page_count </span><span style="color:gray;">+ </span><span style="color:black;">row_overflow_used_page_count<br />
</span><span style="color:blue;">END<br />
</span><span style="color:gray;">)</span><span style="color:black;">pages<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">sys.dm_db_partition_stats<br />
</span><span style="color:blue;">WHERE </span><span style="color:magenta;">OBJECT_ID </span><span style="color:blue;">= </span><span style="color:#434343;">@id<br />
</span><span style="color:blue;">GROUP BY </span><span style="color:magenta;">OBJECT_ID</span><span style="color:gray;">, </span><span style="color:black;">index_id<br />
</span><span style="color:gray;">) </span><span style="color:black;">ps </span><span style="color:blue;">ON </span><span style="color:black;">i.index_id </span><span style="color:blue;">= </span><span style="color:black;">ps.index_id<br />
</span><span style="color:blue;">WHERE </span><span style="color:black;">i.</span><span style="color:magenta;">OBJECT_ID </span><span style="color:blue;">= </span><span style="color:#434343;">@id<br />
</span><span style="color:black;">GO</span></code></p>
<p style="text-align:justify;">If you have different script or have suggestions on this script, please let us know.</p>
<p style="text-align:justify;">Reference: <strong>Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.sqlauthority.com</strong></a><strong>)</strong></p>
<br />Posted in Pinal Dave, Readers Contribution, Readers Question, SQL, SQL Authority, SQL Index, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, T SQL, Technology  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/7444/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/7444/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/7444/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/7444/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/7444/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/7444/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/7444/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/7444/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/7444/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/7444/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=7444&subd=sqlauthority&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/11/30/sql-server-size-of-index-table-for-each-index-solution/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER &#8211; Size of Index Table &#8211; A Puzzle to Find Index Size for Each Index on Table</title>
		<link>http://blog.sqlauthority.com/2009/11/18/sql-server-size-of-index-table-a-puzzle-to-find-index-size-for-each-index-on-table/</link>
		<comments>http://blog.sqlauthority.com/2009/11/18/sql-server-size-of-index-table-a-puzzle-to-find-index-size-for-each-index-on-table/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 01:30:16 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Index]]></category>
		<category><![CDATA[SQL Puzzle]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Stored Procedure]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQLServer]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7388</guid>
		<description><![CDATA[It is very easy to find out some basic details of any table using the following Stored Procedure.
USE AdventureWorks
GO
EXEC sp_spaceused [HumanResources.Shift]
GO
Above query will return following resultset

The above SP provides basic details such as rows, data size in table, and Index size of all the indexes on the table.
If we look at this carefully, a total [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=7388&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">It is very easy to find out some basic details of any table using the following Stored Procedure.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">AdventureWorks<br />
GO<br />
</span><span style="color:blue;">EXEC </span><span style="color:darkred;">sp_spaceused </span><span style="color:black;">[HumanResources.Shift]<br />
GO</span></code></p>
<p style="text-align:justify;">Above query will return following resultset</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/sp_spaceused1.jpg" alt="" width="369" height="153" /></p>
<p style="text-align:justify;">The above SP provides basic details such as rows, data size in table, and Index size of all the indexes on the table.</p>
<p style="text-align:justify;">If we look at this carefully, a total of three indexes can be found on the table HumanResources.Shift.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">AdventureWorks<br />
GO<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">*<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">sys.indexes<br />
</span><span style="color:blue;">WHERE </span><span style="color:magenta;">OBJECT_ID </span><span style="color:blue;">= </span><span style="color:magenta;">OBJECT_ID</span><span style="color:gray;">(</span><span style="color:red;">'HumanResources.Shift'</span><span style="color:gray;">)<br />
</span><span style="color:black;">GO</span></code></p>
<p style="text-align:justify;">The above query will give result with query listing all the index on the table.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/indexspace.jpg" alt="" width="500" height="248" /></p>
<p style="text-align:justify;">There is a small puzzle for all of you here. The puzzle is to write a query that will return the size for each index that is listed in above query. We need a query that will return an additional column in the above listed query and it should contain the size of the index. In our case, we will have three different sizes, which should add up to a total of 40 KB as shown in earlier query, where the total size is displayed.</p>
<p style="text-align:justify;">I will publish the solution with due credit on this blog.</p>
<p style="text-align:justify;">Reference: <strong>Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.sqlauthority.com</strong></a><strong>)</strong></p>
<br />Posted in Pinal Dave, Readers Question, SQL, SQL Authority, SQL Index, SQL Puzzle, SQL Query, SQL Scripts, SQL Server, SQL Stored Procedure, SQL Tips and Tricks, SQLServer, T SQL, Technology  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/7388/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/7388/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/7388/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/7388/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/7388/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/7388/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/7388/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/7388/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/7388/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/7388/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=7388&subd=sqlauthority&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/11/18/sql-server-size-of-index-table-a-puzzle-to-find-index-size-for-each-index-on-table/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/sp_spaceused1.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/indexspace.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Change Collation of Database Column &#8211; T-SQL Script &#8211; Consolidating Collations &#8211; Extention Script</title>
		<link>http://blog.sqlauthority.com/2009/10/19/sql-server-change-collation-of-database-column-t-sql-script-consolidating-collations-extention-script/</link>
		<comments>http://blog.sqlauthority.com/2009/10/19/sql-server-change-collation-of-database-column-t-sql-script-consolidating-collations-extention-script/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 01:30:55 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Readers Contribution]]></category>
		<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Utility]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[SQL Collation]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7139</guid>
		<description><![CDATA[This document is created by Brian Cidern, he has written this excellent extension to  SQL Expert who SQL SERVER – Change Collation of Database Column – T-SQL Script. His scripts are not only extremely helpful to achieve the task of consolidating collations in quick script. His script not only works perfectly but excellent piece [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=7139&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">This document is created by <span style="color:#000080;"><strong>Brian Cidern</strong></span>, he has written this excellent extension to  SQL Expert who SQL SERVER – Change Collation of Database Column – T-SQL Script. His scripts are not only extremely helpful to achieve the task of <em><strong>consolidating collations</strong></em> in quick script. His script not only works perfectly but excellent piece of code and logic.</p>
<p style="text-align:justify;">Hats off to you <strong>Brian</strong>! You can reach Brian at his email address (brians.sql.blog (at) gmail (dot) com) or leave comment here.</p>
<h3 style="text-align:justify;"><strong><a href="http://www.pinaldave.com/best-sql-server-download.cfm?Download=SQL_Collation_Consolidation_Scripts" target="_blank">Download all scripts and explanation here</a></strong></h3>
<p style="text-align:justify;"><strong>About Collation Consolidation</strong></p>
<p style="text-align:justify;">At some time in your DBA career, you may find yourself in a position when you sit back and realize that your database collations have somehow run amuck, or are faced with the ever annoying CANNOT RESOLVE COLLATION message when trying to join data of varying collation settings.  I’m sure there are as many reasons as to how you’ve come to this juncture as there are readers.  Maybe you have DBA’s and instances around the world and the local staff are using their own collations.  Or, maybe you’ve learned the hard way that ALTER DATABASE x SET COLLATION y doesn’t traverse.  Whatever it is, you’re probably here for the one underlying reason.  Manually consolidating collations would be a nightmare.  So, without loading to much fluff, let’s jump right in.</p>
<p style="text-align:justify;">Here is the basic approach:</p>
<ol style="text-align:justify;">
<li>Identify all the      columns which have incorrect collation values.</li>
<li>Identify all      objects bound to above columns, including indexes, keys, checks and UDF’s,</li>
<li>Script out all      of the above object DDL.</li>
<li>Drop all of the      objects.</li>
<li>Update all the      columns with the correct collation</li>
<li>Recreate all of      the dropped objects using the DDL generated in step 3</li>
</ol>
<p style="text-align:justify;">This is done with a collection of non-destructive scripts which generate the DDL to perform all of the above.  This generated DDL MUST be saved to scripts for later use on the target databases.  And obviously, you’ll need one set of scripts per database.  If that requires clarification, just stop reading now.</p>
<p style="text-align:justify;">In this article, I give to you the four scripts to do all this and will try to provide as much understanding as possible.  The first script is purely to create a stored procedure which will be repeatedly called.  This proc will need to exist in a database named “DBADB”.  If you want to use a different database, you’ll need to do a search and replace in the first script and the last script since the database name is hard-coded.  I tried to make these somewhat generic, but the only approach that came to mind would be to use OLE to invoke the VBScript engine to prompt you for the name of the database where this stored procedure is located.  Overkill in my opinion.  Ctrl-H is your friend here.</p>
<p style="text-align:justify;">The script to perform step 3 above uses DMO via OLE, so if you’ve disabled the extended stored procedures; sp_OACreate, sp_OASetProperty, sp_OAMethod, etc, you won’t be able to continue until they’ve been enabled.</p>
<p style="text-align:justify;">One final note.  If you’re not a member of the System Administrators role, please don’t try to execute these.  You’ll probably find your account revoked quickly.</p>
<p style="text-align:justify;">Ok, time to roll up your sleeves.</p>
<p style="text-align:justify;"><strong>Script 1 – The DDL Generator</strong></p>
<p style="text-align:justify;">This first script is to create a stored procedure.  This procedure must reside in a location that will not interfere with other databases, whether they’re development, test or production.  The SP uses DMO via OLE to capture a buffer dump of the object code.  The result is the same as if you right-clicked an object and selected “Script to new window as…”</p>
<p style="text-align:justify;">The DMO hierarchy of a SQL instance is weird.  Object reference isn’t particularly intuitive.  But, for the most part, objects are contained within the associated table collection.  In DBA language, that would look like</p>
<p style="text-align:justify;">Table 1:M Checks</p>
<p style="text-align:justify;">Table 1:M Keys</p>
<p style="text-align:justify;">Table 1:M Indexes</p>
<p style="text-align:justify;">Database 1:M UserDefinedFunctions</p>
<p style="text-align:justify;">Therefore, to locate a particular object in the DMO hierarchy, you would need to pass in all the required parameters, including the object type.  So, for checks, keys and indexes, you must also pass in the database name and the parent table name.  For functions, only the database name.</p>
<p style="text-align:justify;">sp_scriptObject(</p>
<p style="text-align:justify;">@in_dbName SysName,</p>
<p style="text-align:justify;">@in_objType VarChar(100),</p>
<p style="text-align:justify;">@in_objName VarChar(100),</p>
<p style="text-align:justify;">@in_objSubName VarChar(100) = NULL</p>
<p style="text-align:justify;">)</p>
<p style="text-align:justify;">Now, the good news.  The subsequent scripts will do all of the above automatically, and this script will be called repeatedly.</p>
<p style="text-align:justify;"><strong>Implementing this script.</strong></p>
<p style="text-align:justify;">As I mentioned, this script will be called repeatedly.  The script from whence it’s called will need to be modified to make reference to the correct database name.  These scripts have been designed to work with a DBA-use only database called “DBADB”.  Therefore, if you choose to keep this procedure located in a database of a different name, you’ll need to perform a search and replace for all the “DBADB” reference.  Otherwise, you will need to create a database named “DBADB”.</p>
<p style="text-align:justify;">Execute the first script.  This will create the necessary stored procedure.</p>
<p style="text-align:justify;"><strong>Script 2 – Drop Dependencies</strong></p>
<p style="text-align:justify;">The name for this script is somewhat deceiving.  It is a non-destructive script and only performs a set of SELECT statements.  Rather, this script generates a collection of DROP [object] statements.</p>
<p style="text-align:justify;">The goal here is to identify all the objects that are bound to columns which have incorrect collation settings.  There is no clean way to pull them all back in a single statement since determining this is handled differently for the various types of objects.  So, they’re all concatenated together with UNION’s.  The orders in which these are executed are as follows:</p>
<ol style="text-align:justify;">
<li>Table Functions</li>
<li>Unique      Constraints</li>
<li>Check      Constraints</li>
<li>Indexes</li>
</ol>
<p style="text-align:justify;"><em>You must also edit this script to use your desired collation.  Perform a search and replace of SQL_Latin1_General_CI_AS to your chosen collation.</em></p>
<p style="text-align:justify;">It’s performed in this order in attempt to avoid dependency issues.</p>
<p style="text-align:justify;">The result is a collection of DROP statements.  This must then be copy and pasted into a script and saved for later use.  Best to use a naming convention that reflects the name of the database, and that this will be the first script to execute when you’re ready to begin the patching, for example: myDatabase_post-script_1.sql, myDatabase_post-script_2.sql, etc.</p>
<p style="text-align:justify;">You should take note, it is possible that some databases may not have any objects that are bound to columns that need to be updated, so it’s perfectly fine if this script produces no results.</p>
<p style="text-align:justify;"><strong>Script 3 – Change Collations</strong></p>
<p style="text-align:justify;">Much like script 2, this script is also non-destructive and will produce a collection of DDL statements to update the column collations.</p>
<p style="text-align:justify;"><em>You must also edit this script to use your desired collation.  Perform a search and replace of SQL_Latin1_General_CI_AS to your chosen collation.</em></p>
<p style="text-align:justify;"><strong><span style="text-decoration:underline;"> </span></strong></p>
<p style="text-align:justify;"><strong><span style="text-decoration:underline;">VERY IMPORTANT</span></strong>.  These scripts were originally intended to allow us to consolidate all our collations in a SQL 2000 to SQL 2008 migration.  Therefore, this script WILL produce two lines of code that you may or may not want.</p>
<p style="text-align:justify;">ALTER DATABASE &#8216; + DB_NAME() + &#8216; SET COMPATIBILITY_LEVEL=100</p>
<p style="text-align:justify;">and</p>
<p style="text-align:justify;">ALTER DATABASE &#8216; + DB_NAME() + &#8216; COLLATE &#8216; + @collation</p>
<p style="text-align:justify;">where @collation is a variable defined at the beginning of the script.</p>
<p style="text-align:justify;">You can alter the original script I’ve provided, or you can simply remove them from the output before saving.</p>
<p style="text-align:justify;">The remaining results will be a collection of statements to alter the column collations:</p>
<p style="text-align:justify;">ALTER TABLE [tbl] ALTER COLUMN [clm] column_spec() COLLATE [new_collation]</p>
<p style="text-align:justify;">Once this has been executed, copy and paste the output into another script file for later use (myDatabase_post-script_2.sql)</p>
<p style="text-align:justify;"><strong>Script 4 – Create Dependent Objects</strong></p>
<p style="text-align:justify;">This is where most of the work takes place.</p>
<p style="text-align:justify;"><em>You must also edit this script to use your desired collation.  Perform a search and replace of SQL_Latin1_General_CI_AS to your chosen collation.</em></p>
<p style="text-align:justify;">Open the script, connect to the desired database and hit the [fire] button.  Again, like those previous, this script is non-destructive, and produces a series of DDL statements.</p>
<p style="text-align:justify;">The first you’ll notice in the output is the “USE DBADB” statement.  It is very important to note here that if the stored procedure (sp_scriptObject) from the very first script is stored in another database, that this is reflected in the output.</p>
<p style="text-align:justify;">The remainder of the output looks like:</p>
<p style="text-align:justify;">EXEC DBADB.dbo.sp_scriptObject…</p>
<p style="text-align:justify;">With all of the required parameters, based on the type and location of the object.  The other thing you may notice here is that the order in which these statements are in, is the exact reverse of the order from the 2<sup>nd</sup> script; again, with the intent to avoid dependency crashes.</p>
<p style="text-align:justify;">This output now needs to be copy and pasted to a new query window – not to a file.  The output of the new window should be set to text (Query &gt; Results in Text) or (Ctrl-T).  Execute the statements.  Be aware, that this could take a significant amount of time based on the number of objects and how complex they are.</p>
<p style="text-align:justify;">But, in essence, you will be trapping a buffer dump for each object that needs to be dropped.</p>
<p style="text-align:justify;"><strong><span style="text-decoration:underline;">VERY IMPORTANT.</span></strong></p>
<p style="text-align:justify;">There may be a case where an object’s DDL is simply too large.  There are limitations in which the VBScript engine stores string data.  I can’t recall exactly what the issue was, nor do I care to look it up again. But basically, the buffer is limited to 8k.  If your object DDL is greater than 8k, an error will be thrown and the object DDL will NOT be trapped.</p>
<p style="text-align:justify;">After this script has finished, you must first scan the output for errors.  If any are found, identify the object which was not scripted and manually script those and paste them into the output.</p>
<p style="text-align:justify;">This output must then be saved to a final script for execution against the target database.</p>
<p style="text-align:justify;"><strong>Final Step</strong></p>
<p style="text-align:justify;">In the end, the above work will have produced 3 scripts that now need to be run against the target database.  Now is a good time to clarify that these generated scripts are very destructive.  So, please take your time, test, test and test.  If you choose to do this on a production box, your career could be at stake.  There is never one-size-fits-all solution, so for each scenario, these scripts may required modifications.  These were produced to fix my needs, but I did try to keep them as generic as possible for re-use.</p>
<p style="text-align:justify;">On your target database, execute each of the generated scripts, obviously in the order specified.</p>
<p style="text-align:justify;">The net result will leave your database with each column, along with the database set at your desired collation setting.</p>
<p style="text-align:justify;"><strong>The Quick and Dirty Approach</strong></p>
<p style="text-align:justify;">This section is for those who don’t really care to know the details and simply provides an exact step-by-step.</p>
<ol style="text-align:justify;">
<li>Backup the      target database.</li>
<li>Copy the 4      scripts to an empty folder.</li>
<li>Open      Pre-Script_1_DROP_DEPENDENCIES.sql in a text editor and perform a search      and replace of “Latin1_General_CI_AS” and change this to the desired      collation.</li>
<li>Open Pre-Script_2_CHANGE_COLLATIONS.sql      in a text editor and perform a search and replace of “Latin1_General_CI_AS”      and change this to the desired collation.</li>
<li>Open Pre-Script_3_CREATE_DEPENDENCIES.sql      in a text editor and perform a search and replace of “Latin1_General_CI_AS”      and change this to the desired collation.</li>
<li>Create a      database named “DBADB”</li>
<li>Execute Pre-Script_0_DBADB.sp_scriptObject.sql</li>
<li>Change the      working database to the one which requires collation changes.</li>
<li>Execute Pre-Script_1_DROP_DEPENDENCIES.sql</li>
<li>Save the output      to a text file named “dbName_post-script_1.sql”</li>
<li>Execute Pre-Script_2_CHANGE_COLLATIONS.sql</li>
<li>Save the output      to a text file named “dbName_post-script_2.sql”</li>
<li>Execute Pre-Script_3_CREATE_DEPENDENCIES.sql</li>
<li>Copy the output      to a new query window and execute.</li>
<li>Scan the      secondary output for errors.       Identify any failed objects and manually script out the DDL.  Paste it into the location where the      error occurred.</li>
<li>Now, save this      output to a text file named “dbName_post-script_3.sql”</li>
<li>Copy      dbName_post-script_1.sql, dbName_post-script_2.sql, and dbName_post-script_3.sql      to the target machine.</li>
<li>Connect to the      desired target database and execute each of the above post-scripts in      numeric order.</li>
</ol>
<p style="text-align:justify;">Good luck.  Please heed any warnings I may have mentioned.  If you have any questions, certainly send me an email and I will try to answer promptly.  But, also please be patient, I do have a full time job that takes priority.</p>
<p style="text-align:justify;"><strong>Brian Cidern<br />
brians.sql.blog (at) gmail (dot) com</strong></p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br />Posted in Readers Contribution, Readers Question, SQL, SQL Authority, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, SQL Utility, T SQL, Technology Tagged: SQL Collation <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/7139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/7139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/7139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/7139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/7139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/7139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/7139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/7139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/7139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/7139/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=7139&subd=sqlauthority&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/10/19/sql-server-change-collation-of-database-column-t-sql-script-consolidating-collations-extention-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER &#8211; Plan Caching and Schema Change &#8211; An Interesting Observation</title>
		<link>http://blog.sqlauthority.com/2009/09/14/sql-server-plan-caching-and-schema-change-an-interesting-observation/</link>
		<comments>http://blog.sqlauthority.com/2009/09/14/sql-server-plan-caching-and-schema-change-an-interesting-observation/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 01:30:10 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Management Studio]]></category>
		<category><![CDATA[SQL Stored Procedure]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Utility]]></category>
		<category><![CDATA[SQL White Papers]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[SQL Cache]]></category>
		<category><![CDATA[SQL Profiler]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=6756</guid>
		<description><![CDATA[Last week, I had published details regarding SQL SERVER – Plan Caching in SQL Server 2008 by Greg Low on this blog. Similar to any other white paper, I have read this paper very carefully and enjoyed reading it. One particular topic in the white paper that caught my attention is definition of schema change. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=6756&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Last week, I had published details regarding <a href="http://blog.sqlauthority.com/2009/08/29/sql-server-plan-caching-in-sql-server-2008-by-greg-low/" target="_blank">SQL SERVER – Plan Caching in SQL Server 2008 by Greg Low</a> on this blog. Similar to any other white paper, I have read this paper very carefully and enjoyed reading it. One particular topic in the white paper that caught my attention is definition of schema change. I was well aware of this definition, but I have often found that users are not familiar with what exactly does a schema change mean.</p>
<p style="text-align:justify;">Many people assume that a change in the table structure is schema change. In fact, creating or dropping index on any table also qualifies as schema change.</p>
<p style="text-align:justify;">As per the white paper, “Schema change” is defined as follows:</p>
<ul style="text-align:justify;">
<li>Adding      or dropping columns to a table or view.</li>
<li>Adding      or dropping constraints, defaults, or rules to/from a table.</li>
<li><em>Adding an index to a table or an indexed view.</em></li>
<li><em>Dropping an index defined on a table or an indexed view (only      if the index is used by the query plan in question).</em></li>
<li>Dropping      a statistic (not creating or updating!) defined on a table will cause a      correctness-related recompilation of any query plans that use that table.      Such recompilations occur at that instant when the query plan in question      begins execution. Updating a statistic (both manual and auto-update) will      cause an optimality-related (data related) recompilation of any query      plans that uses this statistic.</li>
</ul>
<p style="text-align:justify;">As per the above definition, I decided to experiment with schema change. In white paper, it was mentioned that schema change will recompile the execution batch. I decided to test this out. I created a small script (given below) and decided to test it.</p>
<p style="text-align:justify;">As per the script, I created a large table and stored the procedure that was accessing that table. I created another object that was an index to the table; when SP was ran with index on table, it showed a plan different from that without the index on table. It was evident that the batch was recompiled when the index on the table was modified.</p>
<p style="text-align:justify;"><a href="http://www.pinaldave.com/sql-download/scripts/planchange.zip" target="_blank">The script is available here to download.</a></p>
<p style="text-align:justify;"><strong>Without Index execution plan:</strong></p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/exindex.jpg" alt="" width="500" height="140" /></p>
<p style="text-align:justify;"><strong>With Index execution plan:</strong></p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/exnoindex.jpg" alt="" width="502" height="149" /></p>
<p style="text-align:justify;">
<p>It is clear from the execution plan that it is different, and this proves the point that schema change recompiles the execution plan.</p>
<p>There is one more script provided in the white paper, which gets data from DMV related to cached plan. When I ran the following SP, it did not give me very interesting results.</p>
<p><code style="font-size:12px;"><span style="color:blue;">SELECT </span><span style="color:black;">cp.objtype </span><span style="color:blue;">AS </span><span style="color:black;">PlanType</span><span style="color:gray;">,<br />
</span><span style="color:magenta;">OBJECT_NAME</span><span style="color:gray;">(</span><span style="color:black;">st.objectid</span><span style="color:gray;">,</span><span style="color:black;">st.dbid</span><span style="color:gray;">) </span><span style="color:blue;">AS </span><span style="color:black;">ObjectName</span><span style="color:gray;">,<br />
</span><span style="color:black;">cp.refcounts </span><span style="color:blue;">AS </span><span style="color:black;">ReferenceCounts</span><span style="color:gray;">,<br />
</span><span style="color:black;">cp.usecounts </span><span style="color:blue;">AS </span><span style="color:black;">UseCounts</span><span style="color:gray;">,<br />
</span><span style="color:black;">st.</span><span style="color:blue;">TEXT AS </span><span style="color:black;">SQLBatch</span><span style="color:gray;">,<br />
</span><span style="color:black;">qp.query_plan </span><span style="color:blue;">AS </span><span style="color:black;">QueryPlan<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">sys.dm_exec_cached_plans </span><span style="color:blue;">AS </span><span style="color:black;">cp<br />
</span><span style="color:gray;">CROSS </span><span style="color:black;">APPLY sys.dm_exec_query_plan</span><span style="color:gray;">(</span><span style="color:black;">cp.plan_handle</span><span style="color:gray;">) </span><span style="color:blue;">AS </span><span style="color:black;">qp<br />
</span><span style="color:gray;">CROSS </span><span style="color:black;">APPLY sys.dm_exec_sql_text</span><span style="color:gray;">(</span><span style="color:black;">cp.plan_handle</span><span style="color:gray;">) </span><span style="color:blue;">AS </span><span style="color:black;">st</span><span style="color:gray;">;</span></code></p>
<p><span style="color:gray;"><img class="alignnone" src="http://www.pinaldave.com/bimg/exusecount.jpg" alt="" width="499" height="168" /><br />
</span></p>
<p>When I ran the above script, I found that the UseCount column did not reset when QueryPlan is changed. This was very surprising as I was expecting UseCount to reset on changing the query plan. I sent an email to <a href="http://www.solidq.com.au/" target="_blank">Dr. Greg Low</a>, who is author of this white paper. He was very kind to respond back within minutes with a proper answer, which is as follows:</p>
<p><strong><em>You’ll notice in Profiler when you run the sproc after creating the index that it does in fact cause a recompile. However, in SQL Server 2008 (and 2005), these are statement level recompiles not proc level recompiles. I imagine that’s why they’re not reflected in the UseCount values ie: the plan itself isn’t recompiled and that’s what the counts are based on.</em></strong></p>
<p><img class="alignnone" src="http://www.pinaldave.com/bimg/exprofiler.jpg" alt="" width="560" height="120" /></p>
<p style="text-align:justify;">Well, this simple explanation clarified my doubts. Let me know what you think, and I strongly suggest you all to read the <a href="http://blog.sqlauthority.com/2009/08/29/sql-server-plan-caching-in-sql-server-2008-by-greg-low/" target="_blank">white paper</a> written by Dr. Greg Low.</p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.sqlauthority.com</strong></a><strong>)</strong></p>
<br />Posted in Pinal Dave, Readers Question, SQL, SQL Authority, SQL Documentation, SQL Query, SQL Scripts, SQL Server, SQL Server Management Studio, SQL Stored Procedure, SQL Tips and Tricks, SQL Utility, SQL White Papers, T SQL, Technology Tagged: SQL Cache, SQL Profiler <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/6756/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/6756/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/6756/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/6756/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/6756/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/6756/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/6756/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/6756/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/6756/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/6756/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=6756&subd=sqlauthority&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/09/14/sql-server-plan-caching-and-schema-change-an-interesting-observation/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/exindex.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/exnoindex.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/exusecount.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/exprofiler.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Find Gaps in The Sequence</title>
		<link>http://blog.sqlauthority.com/2009/09/06/sql-server-find-gaps-in-the-sequence/</link>
		<comments>http://blog.sqlauthority.com/2009/09/06/sql-server-find-gaps-in-the-sequence/#comments</comments>
		<pubDate>Sun, 06 Sep 2009 01:30:26 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Contribution]]></category>
		<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQLServer]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Identity]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=6723</guid>
		<description><![CDATA[I have previously written two articles on the subject of missing identity and both are very well received by community. I had great fun to write article as many SQL Server expert participated in both the articles. Expert Imran Mohammed had provided excellent script to find missing identity. Please read both the articles for additional [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=6723&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">I have previously written two articles on the subject of missing identity and both are very well received by community. I had great fun to write article as many SQL Server expert participated in both the articles. Expert <strong>Imran Mohammed </strong>had provided excellent script to find missing identity. Please read both the articles for additional information. <strong><br />
</strong></p>
<p style="text-align:justify;"><strong><a href="http://blog.sqlauthority.com/2009/08/11/sql-server-discussion-effect-of-missing-identity-on-system-real-world-scenario/" target="_blank">SQL SERVER – Discussion – Effect of Missing Identity on System – Real World Scenario</a><br />
</strong>
</p>
<p style="text-align:justify;"><strong><a href="http://blog.sqlauthority.com/2009/07/27/sql-server-list-all-missing-identity-values-of-table-in-database/" target="_blank">SQL SERVER – List All Missing Identity Values of Table in Database</a></strong></p>
<p style="text-align:justify;">Well what really interesting is that another user asked similar question to find gaps in sequence. Two different expert Brian and Tejas responded with excellent solution. Let us go over questions and their solutions.</p>
<p style="text-align:justify;"><strong><a href="http://www.pinaldave.com/best-sql-server-download.cfm?Download=Find_Gaps_in_The_Sequence" target="_blank">Download script used in this article</a></strong></p>
<p style="text-align:justify;"><strong>Question by <a href="http://blog.sqlauthority.com/2007/05/13/sql-server-udf-function-to-parse-alphanumeric-characters-from-string/#comment-54724" target="_blank">Enrico</a></strong></p>
<p style="padding-left:30px;text-align:justify;"><em>Hi Pinal/Folks,</em></p>
<p style="padding-left:30px;text-align:justify;"><em>Can anyone please help me? I am stunned at this one.</em></p>
<p style="padding-left:30px;text-align:justify;"><em>Let’s say I have the following records:</em></p>
<p style="padding-left:30px;text-align:justify;"><em>INV0096<br />
INV0097<br />
INV0099<br />
INV0100<br />
INV0102<br />
INV0103</em>
</p>
<p style="padding-left:30px;text-align:justify;"><em>How can I generate a SQL Script that will show me the gaps in the sequence?</em></p>
<p style="padding-left:30px;text-align:justify;"><em>In such a way that the results will give me INV0098 and INV0101.<br />
Or even just the number 98, and 101.</em>
</p>
<p style="padding-left:30px;text-align:justify;"><em>Thank you so much for your time.</em></p>
<p style="padding-left:30px;text-align:justify;"><em>Best regards,</em></p>
<p style="padding-left:30px;text-align:justify;"><em>Enrico</em></p>
<p style="text-align:justify;"><strong>First Solution by <a href="http://blog.sqlauthority.com/2007/05/13/sql-server-udf-function-to-parse-alphanumeric-characters-from-string/#comment-54734" target="_blank">Brian Tkatch</a></strong></p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:green;">/*<br />
Brian Tkatch Solution 1<br />
*/<br />
</span><span style="color:blue;">WITH<br />
</span><span style="color:black;">Data</span><span style="color:gray;">(</span><span style="color:black;">Datum</span><span style="color:gray;">)<br />
</span><span style="color:blue;">AS<br />
</span><span style="color:gray;">(<br />
</span><span style="color:blue;">SELECT </span><span style="color:red;">'INV0096' </span><span style="color:blue;">UNION </span><span style="color:gray;">ALL<br />
</span><span style="color:blue;">SELECT </span><span style="color:red;">'INV0097' </span><span style="color:blue;">UNION </span><span style="color:gray;">ALL<br />
</span><span style="color:blue;">SELECT </span><span style="color:red;">'INV0099' </span><span style="color:blue;">UNION </span><span style="color:gray;">ALL<br />
</span><span style="color:blue;">SELECT </span><span style="color:red;">'INV0100' </span><span style="color:blue;">UNION </span><span style="color:gray;">ALL<br />
</span><span style="color:blue;">SELECT </span><span style="color:red;">'INV0102' </span><span style="color:blue;">UNION </span><span style="color:gray;">ALL<br />
</span><span style="color:blue;">SELECT </span><span style="color:red;">'INV0103'<br />
</span><span style="color:gray;">),<br />
</span><span style="color:black;">CTE<br />
</span><span style="color:blue;">AS<br />
</span><span style="color:gray;">(<br />
</span><span style="color:blue;">SELECT<br />
</span><span style="color:magenta;">CAST</span><span style="color:gray;">(</span><span style="color:magenta;">SUBSTRING</span><span style="color:gray;">(</span><span style="color:blue;">MIN</span><span style="color:gray;">(</span><span style="color:black;">Datum</span><span style="color:gray;">), </span><span style="color:black;">4</span><span style="color:gray;">, </span><span style="color:black;">4</span><span style="color:gray;">) </span><span style="color:blue;">AS INT</span><span style="color:gray;">) </span><span style="color:black;">Start</span><span style="color:gray;">,<br />
</span><span style="color:magenta;">CAST</span><span style="color:gray;">(</span><span style="color:magenta;">SUBSTRING</span><span style="color:gray;">(</span><span style="color:blue;">MAX</span><span style="color:gray;">(</span><span style="color:black;">Datum</span><span style="color:gray;">), </span><span style="color:black;">4</span><span style="color:gray;">, </span><span style="color:black;">4</span><span style="color:gray;">) </span><span style="color:blue;">AS INT</span><span style="color:gray;">) </span><span style="color:black;">Finish<br />
</span><span style="color:blue;">FROM<br />
</span><span style="color:black;">Data<br />
</span><span style="color:blue;">UNION </span><span style="color:gray;">ALL<br />
</span><span style="color:blue;">SELECT<br />
</span><span style="color:black;">Start </span><span style="color:gray;">+ </span><span style="color:black;">1</span><span style="color:gray;">,<br />
</span><span style="color:black;">Finish<br />
</span><span style="color:blue;">FROM<br />
</span><span style="color:black;">CTE<br />
</span><span style="color:blue;">WHERE<br />
</span><span style="color:black;">Start </span><span style="color:gray;">&lt; </span><span style="color:black;">Finish<br />
</span><span style="color:gray;">)<br />
</span><span style="color:blue;">SELECT<br />
</span><span style="color:black;">Common.Formatted<br />
</span><span style="color:blue;">FROM<br />
</span><span style="color:black;">CTE<br />
</span><span style="color:gray;">CROSS </span><span style="color:black;">APPLY</span><span style="color:gray;">(</span><span style="color:blue;">SELECT </span><span style="color:red;">'INV' </span><span style="color:gray;">+ </span><span style="color:magenta;">RIGHT</span><span style="color:gray;">(</span><span style="color:red;">'0000' </span><span style="color:gray;">+ </span><span style="color:magenta;">CAST</span><span style="color:gray;">(</span><span style="color:black;">Start </span><span style="color:blue;">AS VARCHAR</span><span style="color:gray;">(</span><span style="color:black;">4</span><span style="color:gray;">)), </span><span style="color:black;">4</span><span style="color:gray;">)) </span><span style="color:black;">Common</span><span style="color:gray;">(</span><span style="color:black;">Formatted</span><span style="color:gray;">)<br />
</span><span style="color:blue;">WHERE<br />
</span><span style="color:gray;">NOT EXISTS<br />
(<br />
</span><span style="color:blue;">SELECT<br />
</span><span style="color:gray;">*<br />
</span><span style="color:blue;">FROM<br />
</span><span style="color:black;">Data<br />
</span><span style="color:blue;">WHERE<br />
</span><span style="color:black;">Data.Datum </span><span style="color:blue;">= </span><span style="color:black;">Common.Formatted<br />
</span><span style="color:gray;">)<br />
</span><span style="color:blue;">OPTION<br />
</span><span style="color:gray;">(</span><span style="color:black;">MAXRECURSION 0</span><span style="color:gray;">);</span></code>
</p>
<p style="text-align:justify;"><strong>Second Solution by <a href="http://blog.sqlauthority.com/2007/05/13/sql-server-udf-function-to-parse-alphanumeric-characters-from-string/#comment-54734" target="_blank">Brian Tkatch</a></strong></p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:green;">/*<br />
Brian Tkatch Solution 2<br />
The CROSS APPLY is just nice, but not required. Without it, the query is very similar:<br />
*/<br />
</span><span style="color:blue;">WITH<br />
</span><span style="color:black;">Data</span><span style="color:gray;">(</span><span style="color:black;">Datum</span><span style="color:gray;">)<br />
</span><span style="color:blue;">AS<br />
</span><span style="color:gray;">(<br />
</span><span style="color:blue;">SELECT </span><span style="color:red;">'INV0096' </span><span style="color:blue;">UNION </span><span style="color:gray;">ALL<br />
</span><span style="color:blue;">SELECT </span><span style="color:red;">'INV0097' </span><span style="color:blue;">UNION </span><span style="color:gray;">ALL<br />
</span><span style="color:blue;">SELECT </span><span style="color:red;">'INV0099' </span><span style="color:blue;">UNION </span><span style="color:gray;">ALL<br />
</span><span style="color:blue;">SELECT </span><span style="color:red;">'INV0100' </span><span style="color:blue;">UNION </span><span style="color:gray;">ALL<br />
</span><span style="color:blue;">SELECT </span><span style="color:red;">'INV0102' </span><span style="color:blue;">UNION </span><span style="color:gray;">ALL<br />
</span><span style="color:blue;">SELECT </span><span style="color:red;">'INV0103'<br />
</span><span style="color:gray;">),<br />
</span><span style="color:black;">CTE<br />
</span><span style="color:blue;">AS<br />
</span><span style="color:gray;">(<br />
</span><span style="color:blue;">SELECT<br />
</span><span style="color:magenta;">CAST</span><span style="color:gray;">(</span><span style="color:magenta;">SUBSTRING</span><span style="color:gray;">(</span><span style="color:blue;">MIN</span><span style="color:gray;">(</span><span style="color:black;">Datum</span><span style="color:gray;">), </span><span style="color:black;">4</span><span style="color:gray;">, </span><span style="color:black;">4</span><span style="color:gray;">) </span><span style="color:blue;">AS INT</span><span style="color:gray;">) </span><span style="color:black;">Start</span><span style="color:gray;">,<br />
</span><span style="color:magenta;">CAST</span><span style="color:gray;">(</span><span style="color:magenta;">SUBSTRING</span><span style="color:gray;">(</span><span style="color:blue;">MAX</span><span style="color:gray;">(</span><span style="color:black;">Datum</span><span style="color:gray;">), </span><span style="color:black;">4</span><span style="color:gray;">, </span><span style="color:black;">4</span><span style="color:gray;">) </span><span style="color:blue;">AS INT</span><span style="color:gray;">) </span><span style="color:black;">Finish<br />
</span><span style="color:blue;">FROM<br />
</span><span style="color:black;">Data<br />
</span><span style="color:blue;">UNION </span><span style="color:gray;">ALL<br />
</span><span style="color:blue;">SELECT<br />
</span><span style="color:black;">Start </span><span style="color:gray;">+ </span><span style="color:black;">1</span><span style="color:gray;">,<br />
</span><span style="color:black;">Finish<br />
</span><span style="color:blue;">FROM<br />
</span><span style="color:black;">CTE<br />
</span><span style="color:blue;">WHERE<br />
</span><span style="color:black;">Start </span><span style="color:gray;">&lt; </span><span style="color:black;">Finish<br />
</span><span style="color:gray;">)<br />
</span><span style="color:blue;">SELECT<br />
</span><span style="color:red;">'INV' </span><span style="color:gray;">+ </span><span style="color:magenta;">RIGHT</span><span style="color:gray;">(</span><span style="color:red;">'0000' </span><span style="color:gray;">+ </span><span style="color:magenta;">CAST</span><span style="color:gray;">(</span><span style="color:black;">Start </span><span style="color:blue;">AS VARCHAR</span><span style="color:gray;">(</span><span style="color:black;">4</span><span style="color:gray;">)), </span><span style="color:black;">4</span><span style="color:gray;">)<br />
</span><span style="color:blue;">FROM<br />
</span><span style="color:black;">CTE<br />
</span><span style="color:blue;">WHERE<br />
</span><span style="color:gray;">NOT EXISTS<br />
(<br />
</span><span style="color:blue;">SELECT<br />
</span><span style="color:gray;">*<br />
</span><span style="color:blue;">FROM<br />
</span><span style="color:black;">Data<br />
</span><span style="color:blue;">WHERE<br />
</span><span style="color:black;">Data.Datum </span><span style="color:blue;">= </span><span style="color:red;">'INV' </span><span style="color:gray;">+ </span><span style="color:magenta;">RIGHT</span><span style="color:gray;">(</span><span style="color:red;">'0000' </span><span style="color:gray;">+ </span><span style="color:magenta;">CAST</span><span style="color:gray;">(</span><span style="color:black;">Start </span><span style="color:blue;">AS VARCHAR</span><span style="color:gray;">(</span><span style="color:black;">4</span><span style="color:gray;">)), </span><span style="color:black;">4</span><span style="color:gray;">)<br />
)<br />
</span><span style="color:blue;">OPTION<br />
</span><span style="color:gray;">(</span><span style="color:black;">MAXRECURSION 0</span><span style="color:gray;">);</span></code>
</p>
<p style="text-align:justify;"><strong>Third Solution by <a href="http://blog.sqlauthority.com/2007/05/13/sql-server-udf-function-to-parse-alphanumeric-characters-from-string/#comment-54736" target="_blank">Tejas Shah</a></strong></p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:green;">/*<br />
Tejas Shah Solution 3<br />
*/<br />
</span><span style="color:blue;">DECLARE </span><span style="color:#434343;">@Test </span><span style="color:blue;">TABLE </span><span style="color:gray;">(</span><span style="color:black;">Data </span><span style="color:blue;">VARCHAR</span><span style="color:gray;">(</span><span style="color:black;">10</span><span style="color:gray;">))<br />
</span><span style="color:blue;">INSERT INTO </span><span style="color:#434343;">@test<br />
</span><span style="color:blue;">SELECT </span><span style="color:red;">'INV0096'<br />
</span><span style="color:blue;">UNION </span><span style="color:gray;">ALL<br />
</span><span style="color:blue;">SELECT </span><span style="color:red;">'INV0097'<br />
</span><span style="color:blue;">UNION </span><span style="color:gray;">ALL<br />
</span><span style="color:blue;">SELECT </span><span style="color:red;">'INV0099'<br />
</span><span style="color:blue;">UNION </span><span style="color:gray;">ALL<br />
</span><span style="color:blue;">SELECT </span><span style="color:red;">'INV0100'<br />
</span><span style="color:blue;">UNION </span><span style="color:gray;">ALL<br />
</span><span style="color:blue;">SELECT </span><span style="color:red;">'INV0102'<br />
</span><span style="color:blue;">UNION </span><span style="color:gray;">ALL<br />
</span><span style="color:blue;">SELECT </span><span style="color:red;">'INV0103'<br />
</span><span style="color:blue;">UNION </span><span style="color:gray;">ALL<br />
</span><span style="color:blue;">SELECT </span><span style="color:red;">'INV0106'<br />
</span><span style="color:blue;">UNION </span><span style="color:gray;">ALL<br />
</span><span style="color:blue;">SELECT </span><span style="color:red;">'INV0110'<br />
</span><span style="color:gray;">;</span><span style="color:blue;">WITH </span><span style="color:black;">cte1 </span><span style="color:blue;">AS</span><span style="color:gray;">(<br />
</span><span style="color:blue;">SELECT </span><span style="color:magenta;">CAST</span><span style="color:gray;">(</span><span style="color:magenta;">RIGHT</span><span style="color:gray;">(</span><span style="color:black;">Data</span><span style="color:gray;">,</span><span style="color:black;">4</span><span style="color:gray;">) </span><span style="color:blue;">AS INT</span><span style="color:gray;">) </span><span style="color:blue;">AS </span><span style="color:black;">RowID<br />
</span><span style="color:blue;">FROM </span><span style="color:#434343;">@Test<br />
</span><span style="color:gray;">), </span><span style="color:black;">Missing </span><span style="color:blue;">AS</span><span style="color:gray;">(<br />
</span><span style="color:blue;">SELECT MIN</span><span style="color:gray;">(</span><span style="color:black;">RowID</span><span style="color:gray;">) </span><span style="color:blue;">AS </span><span style="color:black;">MissNum</span><span style="color:gray;">,<br />
</span><span style="color:blue;">MAX</span><span style="color:gray;">(</span><span style="color:black;">RowID</span><span style="color:gray;">) </span><span style="color:blue;">AS </span><span style="color:black;">MaxID<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">Cte1<br />
</span><span style="color:blue;">UNION </span><span style="color:gray;">ALL<br />
</span><span style="color:blue;">SELECT </span><span style="color:black;">MissNum </span><span style="color:gray;">+ </span><span style="color:black;">1</span><span style="color:gray;">,<br />
</span><span style="color:black;">MaxID<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">Missing<br />
</span><span style="color:blue;">WHERE </span><span style="color:black;">MissNum </span><span style="color:gray;">&lt; </span><span style="color:black;">MaxID<br />
</span><span style="color:gray;">)<br />
</span><span style="color:blue;">SELECT </span><span style="color:black;">missnum<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">Missing<br />
</span><span style="color:magenta;">LEFT </span><span style="color:blue;">JOIN </span><span style="color:black;">cte1 tt </span><span style="color:blue;">ON </span><span style="color:black;">tt.Rowid </span><span style="color:blue;">= </span><span style="color:black;">Missing.MissNum<br />
</span><span style="color:blue;">WHERE </span><span style="color:black;">tt.Rowid </span><span style="color:blue;">IS </span><span style="color:gray;">NULL<br />
</span><span style="color:blue;">OPTION </span><span style="color:gray;">(</span><span style="color:black;">MAXRECURSION 0</span><span style="color:gray;">);<br />
</span></code>
</p>
<p style="text-align:justify;">Let me know if you know any other trick to achieve the same.</p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.sqlauthority.com</strong></a><strong>)</strong></p>
<br />Posted in Pinal Dave, Readers Contribution, Readers Question, SQL, SQL Authority, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, SQLServer, T SQL, Technology Tagged: Identity <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/6723/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/6723/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/6723/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/6723/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/6723/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/6723/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/6723/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/6723/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/6723/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/6723/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=6723&subd=sqlauthority&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/09/06/sql-server-find-gaps-in-the-sequence/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER &#8211; Reason for SQL Server Agent Starting Before SQL Server Engine Service</title>
		<link>http://blog.sqlauthority.com/2009/08/13/sql-server-reason-for-sql-server-agent-starting-before-sql-server-engine-service/</link>
		<comments>http://blog.sqlauthority.com/2009/08/13/sql-server-reason-for-sql-server-agent-starting-before-sql-server-engine-service/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 01:30:57 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[SQL Server Agent]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=6590</guid>
		<description><![CDATA[Nakul, a dedicated member of the Gandhinagar SQL Server User Group, recently emailed me with a very interesting, but quick question. He asked me why the SQL Server Agent starts before SQL Server Engine does? He made the very valid point that as the SQL Server Engine is the core service, it should start first, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=6590&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Nakul, a dedicated member of the Gandhinagar SQL Server User Group, recently emailed me with a very interesting, but quick question. He asked me <em><strong>why the SQL Server Agent starts before SQL Server Engine does?</strong></em> He made the very valid point that as the SQL Server Engine is the core service, it should start first, and there is little point to running the SQL Server Agent without it.</p>
<p style="text-align:justify;">Off the top of my head, I can offer the following quick reasons for this sequence:</p>
<ul style="text-align:justify;">
<li>The SQL Server Engine does not only run jobs for SQL Server Engine itself. It also runs jobs for other core services like the SQL Server Analysis Service, Integration Service, Reporting Service etc.;</li>
<li>The SQL Server Agent can run almost any kind of task that an Operating system can run. For example invoking any program or running shell scripts;</li>
</ul>
<ul style="text-align:justify;">
<li>The SQL Server Agent also      starts jobs which are scheduled to run the second the SQL Server Engine      starts, and for this reason it is needed; and</li>
<li>Replication, mirroring and a few      other tasks also depend on Agent Jobs.</li>
</ul>
<p style="text-align:justify;">These are the reasons that I have come up with so far. Can you think of any more? Let us have your views.</p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br />Posted in Database, Pinal Dave, Readers Question, SQL, SQL Authority, SQL Query, SQL Security, SQL Server, SQL Tips and Tricks, T SQL, Technology Tagged: SQL Server Agent <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/6590/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/6590/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/6590/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/6590/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/6590/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/6590/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/6590/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/6590/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/6590/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/6590/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=6590&subd=sqlauthority&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/08/13/sql-server-reason-for-sql-server-agent-starting-before-sql-server-engine-service/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER &#8211; Discussion &#8211; Effect of Missing Identity on System &#8211; Real World Scenario</title>
		<link>http://blog.sqlauthority.com/2009/08/11/sql-server-discussion-effect-of-missing-identity-on-system-real-world-scenario/</link>
		<comments>http://blog.sqlauthority.com/2009/08/11/sql-server-discussion-effect-of-missing-identity-on-system-real-world-scenario/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 01:30:13 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[DBA]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Contribution]]></category>
		<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Constraint and Keys]]></category>
		<category><![CDATA[SQL Index]]></category>
		<category><![CDATA[SQL Puzzle]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQLServer]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=6524</guid>
		<description><![CDATA[About a week ago, SQL Server Expert, Imran Mohammed, provided a script, which will list all the missing identity values of a table in a database. In this post, I asked my readers if any could write a similar or better script. The results were interesting. While no one provided a new script, my question [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=6524&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">About a week ago, SQL Server Expert, <strong>Imran Mohammed,</strong> provided a script, which will list all the missing identity values of a table in a database. In this <a href="http://blog.sqlauthority.com/2009/07/27/sql-server-list-all-missing-identity-values-of-table-in-database/">post</a>, I asked my readers if any could write a similar or better script. The results were interesting. While no one provided a new script, my question sparked a very active <a href="http://blog.sqlauthority.com/2009/07/27/sql-server-list-all-missing-identity-values-of-table-in-database/">discussion</a> that is still ongoing.</p>
<p style="text-align:justify;">When providing the script, Imran asked me if I knew of any specific circumstances in which this kind of query could be useful, as he could not think of an instance where it would be necessary to find a missing identity. I was unable to think of a single reason for listing missing identities in a table. I posted Imran&#8217;s script on the assumption that someone would come up with an improved script, but as mentioned earlier, nobody did. Instead, we have been able to follow a very interesting discussion on subject of the need, if any, for listing Missing Identity values.</p>
<p style="text-align:justify;">So, the question is this: &#8220;<strong><em>Do you know a real-world scenario where a Missing Identity value in any table can create problems?</em></strong>&#8220;</p>
<p style="text-align:justify;">I have already received some extremely interesting comments from many experts, and all have posed the above question in one form or another. At this moment, I am still trying to think of an example from my own experience, but have yet to find one. Imran has since come up with one good example. Here is what he and other experts have suggested so far.</p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2009/07/27/sql-server-list-all-missing-identity-values-of-table-in-database/#comment-54117" target="_blank"><strong>Jacob Sebastian</strong></a> &#8211; IDENTITY values are not expected to be sequential and there are all chances of having missing identity values, the most common cause is transaction rollbacks.</p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2009/07/27/sql-server-list-all-missing-identity-values-of-table-in-database/#comment-54139" target="_blank"><strong>Simon Worth</strong></a> &#8211; The identity column is basically just a random number – even though they come sequentially. A developer making an assumption that the next record inserted will have an identity that is 1 more than the last inserted record. And if this is the case – then there are flaws in the logic of the developer.</p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2009/07/27/sql-server-list-all-missing-identity-values-of-table-in-database/#comment-54158" target="_blank"><strong>Jacob Sebastian</strong></a> &#8211; What if the value in my table is 1, 2, 3, 5, 6 etc where “4″ is missing from the sequence. So what is the importance of knowing whether a table has missing identity values or not?</p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2009/07/27/sql-server-list-all-missing-identity-values-of-table-in-database/#comment-54184" target="_blank"><strong>Imran Mohammed</strong></a> &#8211; If you use Identity property as your most unique column and Transaction Identifier, then definitely you would want to know why few transaction did not completely, Is there any specific fashion these transaction fails (Can be found out looking at missing values of identity)&#8230; Could be helpful to debug.</p>
<p style="text-align:justify;">Now it is your turn. Let us have your thoughts.</p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.sqlauthority.com</strong></a><strong>)</strong></p>
<br />Posted in Database, DBA, Pinal Dave, Readers Contribution, Readers Question, SQL, SQL Authority, SQL Constraint and Keys, SQL Index, SQL Puzzle, SQL Query, SQL Server, SQL Tips and Tricks, SQLServer, T SQL, Technology  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/6524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/6524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/6524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/6524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/6524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/6524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/6524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/6524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/6524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/6524/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=6524&subd=sqlauthority&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/08/11/sql-server-discussion-effect-of-missing-identity-on-system-real-world-scenario/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQLAuthority News &#8211; A Quick Guide to Twitter</title>
		<link>http://blog.sqlauthority.com/2009/08/10/sqlauthority-news-a-quick-guide-to-twitter/</link>
		<comments>http://blog.sqlauthority.com/2009/08/10/sqlauthority-news-a-quick-guide-to-twitter/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 01:30:15 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[About Me]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQLAuthority News]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=6004</guid>
		<description><![CDATA[I am a very big fan of Twitter. I have been using it for quite sometime now and I think it is a very convenient way to stay connected with friends, families, and even the world. You can share or connect with them in real-time and tell them what you are doing currently.
The best part [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=6004&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">I am a very big fan of Twitter. I have been using it for quite sometime now and I think it is a very convenient way to stay connected with friends, families, and even the world. You can share or connect with them in real-time and tell them what you are doing currently.</p>
<p style="text-align:justify;">The best part about it is micro-blogging; you are not required to type a whole blog but just a statement of not more than 140 characters. Another advantage is that if you want to put a link then Twitter truncates the url to a tinyurl.com link, thus you can link a large url while saving space for typing more characters. Undoubtedly, Twitter is shrinking our world!</p>
<p style="text-align:justify;">My twitter username is <strong><a href="http://twitter.com/pinaldave" target="_blank">pinaldave</a></strong>.</p>
<p style="text-align:justify;">There are already plenty of guides easily available about how twitter should be used and what are the advantages and disadvantages. You can find plenty of related information on the various sites, so we will not cover them today. In this post we will just see how I use it and what I exactly use it for.</p>
<p style="text-align:justify;">I primarily use it for two reasons 1) to stay connected with my friends by reading their timeline 2) to post important news from my side or this blog on twitter. I use <a href="http://tweetdeck.com/" target="_blank">http://tweetdeck.com</a> currently as my twitter client as it provides me multiple columns of timelines for all necessary groups. I can make my own personal group here as well.</p>
<p style="text-align:justify;"><strong>Twitter Keywords</strong></p>
<p style="text-align:justify;">When I have to reply to someone I use @username for the person and that twit shows up on the person&#8217;s timeline as well as on my timeline. People who are following both of us will be able to view that reply as well. E.g. <em><strong> <a href="http://twitter.com/pinaldave" target="_blank">@pinaldave</a> you love twitter</strong></em>.</p>
<p style="text-align:justify;">When I have to inform everyone that someone has twitted me and I liked it, I simply prefix it with the word RT and that is broadcast to everyone following me. It will also show up as reply/mention of anybody’s name I mentioned in my message. E.g. RT <em><strong><a href="http://twitter.com/pinaldave" target="_blank">@pinaldave</a> you love twitter.</strong></em></p>
<p style="text-align:justify;"><em><strong> </strong></em>When I have to send direct email that can be viewed by only two people, I prefix it with the word D before my message to make it visible to those two; however, for this feature the other person has to follow you first. <em><strong>D <a href="http://twitter.com/pinaldave" target="_blank">pinaldave </a>you love twitter.</strong></em></p>
<p style="text-align:justify;">I often use # for important searchable keywords. Many times, people search those hash tags using twitter search. E.g. Pinal Dave, you love #twitter.</p>
<p style="text-align:justify;"><strong>Follow and Followers</strong></p>
<p style="text-align:justify;">I currently follow only people whom I genuinely want to follow. I do not follow everyone who comes across me. I think it is unfair to follow people if I am not interested in reading them. I keep my timeline open to let people follow me as they prefer and learn about exactly what is happening in my world.</p>
<p style="text-align:justify;">A common adage we have often listened is &#8211; Quality is more important than Quantity. In Twitter this applies perfectly. It really does not matter to have a large number of people following you when they are not really reading your twits. When I follow someone, I give my 100% attention  and read everything they write.</p>
<p style="text-align:justify;"><strong>Twitter is Personal Choice</strong></p>
<p style="text-align:justify;">I am not here to advocate the use of twitter. I would rather suggest that it is completely your choice. More importantly, overuse of twitter can for sure damage your online reputation.</p>
<p style="text-align:justify;">I love twittering but when I am at work, I make sure that I do not leave the client open till I finish my work. It is not fair to my employer if I am twitting during my work time. I do not even respond to emails when I am at my consultancy work.</p>
<p style="text-align:justify;"><strong>General Twitter Guidelines</strong></p>
<p style="text-align:justify;">There are numerous specialized guidelines for Twitter. Just treat this as your regular conversation. In regular conversation, we do not always repeat what other person suggests. Same way, one should control their RT (re-twitting). Also remember, no one will talk to us if we keep boasting about ourselves too much. Keep this in mind while twittering. I can go on writing about Twitter here, but I am sure you are pretty smart and can assume other rules by yourself.</p>
<p style="text-align:justify;">The person from whom I learn tricks about twitter is Brent Ozar (<a href="http://twitter.com/brento" target="_blank">@BrentO</a>), I like <a href="http://www.brentozar.com/archive/tag/twitter/" target="_blank">his articles</a> on twitter.</p>
<p style="text-align:justify;">You are welcome to follow me on twitter here : <strong><a href="http://twitter.com/pinaldave" target="_blank">pinaldave</a></strong></p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (<a href="http://blog.sqlauthority.com/" target="_blank">http://blog.SQLAuthority.com</a>)</strong></p>
<br />Posted in About Me, Pinal Dave, Readers Question, SQL, SQL Authority, SQL Query, SQL Server, SQL Tips and Tricks, SQLAuthority News, T SQL, Technology  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/6004/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/6004/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/6004/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/6004/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/6004/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/6004/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/6004/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/6004/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/6004/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/6004/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=6004&subd=sqlauthority&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/08/10/sqlauthority-news-a-quick-guide-to-twitter/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQLAuthority News &#8211; Author&#8217;s Birthday &#8211; Top 7 Commenters &#8211; Volunteers</title>
		<link>http://blog.sqlauthority.com/2009/07/30/sqlauthority-news-authors-birthday-top-7-commenters-volunteers/</link>
		<comments>http://blog.sqlauthority.com/2009/07/30/sqlauthority-news-authors-birthday-top-7-commenters-volunteers/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 01:30:18 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[About Me]]></category>
		<category><![CDATA[DBA]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Contribution]]></category>
		<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQLAuthority News]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=6060</guid>
		<description><![CDATA[Today is July 30 and I am very happy; it’s my Birthday, celebration time!!! The most common question I receive on my every birthday is -what are my plans for birthday. Let me share my plans here today. Additionally, if you are interested to know when SQL Server was born read my post SQLAuthority News [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=6060&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Today is <strong>July 30</strong> and I am very happy; it’s <strong>my Birthday</strong>, celebration time!!! The most common question I receive on my every birthday is -what are my plans for birthday. Let me share my plans here today. Additionally, if you are interested to know when SQL Server was born read my post <strong><a href="http://blog.sqlauthority.com/2008/07/30/sqlauthority-news-author-birthday-sql-server-birthday/" target="_blank">SQLAuthority News – Author BirthDay – SQL Server Birthday</a></strong>.</p>
<p style="text-align:justify;">My first plan is that I am going to take a break from blogging on anything technical today and spend more time with my family.</p>
<p style="text-align:justify;">Let me tell you about my second plan. I am very much pleased and encouraged with active participation from many of you on this blog. I have received so far more than 10s of thousands of comments on my blog. These comments are open for you all to read and you can use them in any fashion that can help you out. Without good participation there is no life in any community, whether it is offline or online.</p>
<p style="text-align:justify;">For the same reason, I have introduced Top 7 Commenters section in the side bar of SQLAuthority.com. There are many active users who have been participating for a long time. One of them I just recognized is Imran Mohammed. This SQL Expert has been extremely helpful to the community and has been providing comprehensive answers to hundreds of questions. Hats Off to you Imran! I totally appreciate your knowledge and dedication to SQL community. Without passion and love toward helping community, this is absolutely not possible.</p>
<p>You can subscribe to <a href="http://feedproxy.google.com/SQLAuthority" target="_blank">SQLAuthority.com feed</a>, which will display all the new posts of my blog as they are published.</p>
<p>You can subscribe to<a href="http://blog.sqlauthority.com/comments/feed/" target="_blank"> SQLAuthority.com comments</a>, which will show all the new comments posted on the blog as they are published.</p>
<p style="text-align:justify;">If you prefer to receive <a href="http://www.feedburner.com/fb/a/emailverifySubmit?feedId=872428" target="_blank">SQLAuthority.com articles in email</a>, you will get all the fresh posts in email.</p>
<p style="text-align:justify;">There is no automated feature for top commenters where I host, so I will have to calculate this manually. I will keep it updated on weekly basis. Every week we will see new names there. First column is number of post, and second column is number name with link to experts website or blog or email.</p>
<p style="text-align:justify;">Every day I receive a couple of emails about starting a forum on SQLAuthority.com. I do plan to start the forum in future. Currently, there are plenty of very good forums on the web. SQLAuthority.com is a blog and below every blog post there is a discussion related to the subject discussed in the blog post.</p>
<p style="text-align:justify;">SQLAuthority.com is all about community and people who are passionate about SQL. Everyone is welcome to participate here. There are many ways to participate.</p>
<p style="text-align:justify;">
<ul style="text-align:justify;">
<li>Discussing blog post</li>
<li>Helping user who have posted their issues on blog</li>
<li>Asking questions</li>
<li>Writing Guest Post</li>
<li>Submitting useful SQL Scripts</li>
<li>Reviewing any Microsoft-related products</li>
<li>Reviewing Books</li>
</ul>
<p style="text-align:justify;">Let me know if you have any other useful and interesting suggestions on how I can involve YOU more in my efforts to take SQL community to the next level.</p>
<p style="text-align:justify;">If you are interested in participating in volunteer program do send me email at pinal &#8216;at&#8217; SQLAuthority.com and we can discuss something out.</p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (<a href="http://blog.sqlauthority.com/" target="_blank">http://blog.sqlauthority.com</a>)</strong></p>
<br />Posted in About Me, Database, DBA, Pinal Dave, Readers Contribution, Readers Question, Software Development, SQL, SQL Authority, SQL Query, SQL Server, SQL Tips and Tricks, SQLAuthority News, T SQL, Technology  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/6060/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/6060/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/6060/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/6060/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/6060/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/6060/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/6060/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/6060/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/6060/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/6060/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=6060&subd=sqlauthority&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/07/30/sqlauthority-news-authors-birthday-top-7-commenters-volunteers/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER &#8211; 2008 &#8211; Copy Database With Data &#8211; Generate T-SQL For Inserting Data From One Table to Another Table</title>
		<link>http://blog.sqlauthority.com/2009/07/29/sql-server-2008-copy-database-with-data-generate-t-sql-for-inserting-data-from-one-table-to-another-table/</link>
		<comments>http://blog.sqlauthority.com/2009/07/29/sql-server-2008-copy-database-with-data-generate-t-sql-for-inserting-data-from-one-table-to-another-table/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 01:30:03 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[DBA]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Utility]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=6043</guid>
		<description><![CDATA[Just about a year ago, I had written on the subject of how to insert data from one table to another table without generating any script or using wizard in my article SQL SERVER – Insert Data From One Table to Another Table – INSERT INTO SELECT – SELECT INTO TABLE. Today, we will go [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=6043&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Just about a year ago, I had written on the subject of how to insert data from one table to another table without generating any script or using wizard in my article <a href="http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/" target="_blank">SQL SERVER – Insert Data From One Table to Another Table – INSERT INTO SELECT – SELECT INTO TABLE</a>. Today, we will go over a similar question regarding how to generate script for data from database as well as table. SQL Server 2008 has simplified everything.</p>
<p style="text-align:justify;">Let us take a look at an example where we will generate script database. In our example, we will just take one table for convenience.</p>
<p style="text-align:justify;">Right Click on Database &gt;&gt; Tasks &gt;&gt; Generate Scripts &gt;&gt;</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/data1.jpg" alt="" width="500" height="428" /></p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/data2.jpg" alt="" width="501" height="451" /></p>
<p style="text-align:justify;">This will pop up Generate SQL Server Scripts Wizards &gt;&gt; Click on Next &gt;&gt; Select Database &gt;&gt; This will bring up a screen that will suggest to Choose Script Option.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/data3.jpg" alt="" width="501" height="451" /></p>
<p style="text-align:justify;">On Choose Script Option Screen of Script Wizard under section Table/View Options Look at Script Data row and Turn the Option to True.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/data4.jpg" alt="" width="503" height="795" /></p>
<p style="text-align:justify;">The Next Screen will ask about object types. Select all the objects that are required in the generated script. Depending on the previous screen it will show few more screen requesting details about the objects required in script generation.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/data5.jpg" alt="" width="501" height="514" /></p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/data6.jpg" alt="" width="501" height="514" /></p>
<p style="text-align:justify;">On the very last screen it will request output options. Select the desired output options of Script to file, Script to Clipboard or Script New Query Window.3</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/data7.jpg" alt="" width="501" height="514" /></p>
<p style="text-align:justify;">Clicking on Finish button will generate a review screen containing the required objects along with script generating data.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/data8.jpg" alt="" width="501" height="549" /></p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/data9.jpg" alt="" width="501" height="549" /></p>
<p style="text-align:justify;">Clicking on Finish button one more time will generate the requested output.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/data10.jpg" alt="" width="500" height="423" /></p>
<p style="text-align:justify;">Similarly, if you want to generate data for only one table, you can right click on the table and follow almost a similar wizard. I am sure this neat feature will help everybody who has been requesting for it for a long time.</p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br />Posted in Best Practices, Database, DBA, Pinal Dave, Readers Question, SQL, SQL Authority, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, SQL Utility, T SQL, Technology  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/6043/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/6043/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/6043/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/6043/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/6043/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/6043/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/6043/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/6043/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/6043/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/6043/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=6043&subd=sqlauthority&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/07/29/sql-server-2008-copy-database-with-data-generate-t-sql-for-inserting-data-from-one-table-to-another-table/feed/</wfw:commentRss>
		<slash:comments>39</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/data1.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/data2.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/data3.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/data4.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/data5.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/data6.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/data7.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/data8.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/data9.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/data10.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Restore Sequence and Understanding NORECOVERY and RECOVERY</title>
		<link>http://blog.sqlauthority.com/2009/07/15/sql-server-restore-sequence-and-understanding-norecovery-and-recovery/</link>
		<comments>http://blog.sqlauthority.com/2009/07/15/sql-server-restore-sequence-and-understanding-norecovery-and-recovery/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 01:30:29 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Data Storage]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5895</guid>
		<description><![CDATA[I maintain a spreadsheet of questions sent by users and from that I single out a topic to write and share my knowledge and opinion. Unless and until I find an issue appealing, I do not prefer to write about it, till the issue crosses the threshold. Today the question that crossed the threshold is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=5895&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">I maintain a spreadsheet of questions sent by users and from that I single out a topic to write and share my knowledge and opinion. Unless and until I find an issue appealing, I do not prefer to write about it, till the issue crosses the threshold. Today the question that crossed the threshold is &#8211; <strong>what is the difference between NORECOERY and RECOVERY when restoring database.</strong></p>
<p style="text-align:justify;">The fact is that one can easily go to MSDN and learn the difference, so I head myself to MSDN and read the difference. This is what the Book On Line suggests <a href="http://msdn.microsoft.com/en-us/library/ms186858.aspx" target="_blank">here</a>.</p>
<p style="padding-left:60px;text-align:justify;"><em><strong> </strong></em></p>
<p style="padding-left:60px;text-align:justify;"><em>NORECOVERY specifies that roll back not occur. This allows roll forward to continue with the next statement in the sequence.<br />
In this case, the restore sequence can restore other backups and roll them forward.<br />
RECOVERY (the default) indicates that roll back should be performed after roll forward is completed for the current backup.<br />
Recovering the database requires that the entire set of data being restored (the roll forward set) is consistent with the database. If the roll forward set has not been rolled forward far enough to be consistent with the database and RECOVERY is specified, the Database Engine issues an error.</em>
</p>
<p style="text-align:justify;">Book On Line has very clearly explained the same subject and provides succinct explanation of the difference.</p>
<p style="text-align:justify;">In other words -</p>
<p style="text-align:justify;"><em><strong>While doing RESTORE Operation if you restoring database files, always use NORECOVER option as that will keep database in state where more backup file are restored. This will also keep database offline also to prevent any changes, which can create itegrity issues. Once all backup file is restored run RESTORE command with RECOVERY option to get database online and operational.</strong></em></p>
<p style="text-align:justify;">It is also important to be acquainted with the restore sequence of how full database backup is restored.</p>
<p style="text-align:justify;">First, restore full database backup, differential database backup and all transactional log backups WITH NORECOVERY Option. After that, bring back database online using WITH RECOVERY option.</p>
<p style="text-align:justify;">Following is the sample Restore Sequence</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">RESTORE DATABASE DATABASE FROM </span><span style="color:black;">full_database_backup </span><span style="color:blue;">WITH </span><span style="color:black;">NORECOVERY</span><span style="color:gray;">;<br />
</span><span style="color:blue;">RESTORE DATABASE DATABASE FROM </span><span style="color:black;">differential_backup </span><span style="color:blue;">WITH </span><span style="color:black;">NORECOVERY</span><span style="color:gray;">;<br />
</span><span style="color:blue;">RESTORE </span><span style="color:magenta;">LOG </span><span style="color:blue;">DATABASE FROM </span><span style="color:black;">log_backup </span><span style="color:blue;">WITH </span><span style="color:black;">NORECOVERY</span><span style="color:gray;">;<br />
</span><span style="color:green;">-- Repeat this till you restore last log backup<br />
</span><span style="color:blue;">RESTORE DATABASE DATABASE WITH </span><span style="color:black;">RECOVERY</span><span style="color:gray;">;</span></code>
</p>
<p style="text-align:justify;">I hope now it is very clear to you all what is restore sequence and the difference between recovery options.</p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (<a href="http://blog.sqlauthority.com/" target="_blank">http://blog.SQLAuthority.com</a>)</strong></p>
<br />Posted in Pinal Dave, Readers Question, SQL, SQL Authority, SQL Backup and Restore, SQL Data Storage, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, T SQL, Technology  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/5895/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/5895/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/5895/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/5895/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/5895/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/5895/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/5895/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/5895/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/5895/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/5895/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=5895&subd=sqlauthority&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/07/15/sql-server-restore-sequence-and-understanding-norecovery-and-recovery/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER &#8211; Maximum Number of Index per Table</title>
		<link>http://blog.sqlauthority.com/2009/06/29/sql-server-maximum-number-of-index-per-table/</link>
		<comments>http://blog.sqlauthority.com/2009/06/29/sql-server-maximum-number-of-index-per-table/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 01:30:05 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Contribution]]></category>
		<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Index]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5733</guid>
		<description><![CDATA[TechEd on Road Ahmedabad, June 20, 2009, was a huge success. This grand event saw over 200 attendees actively participating in the sessions. We had attendees traveling from far and wide, including Delhi, Mumbai, Jaipur, Kerala, Baroda, Himmatnagar, Rajkot, among other cities from India. This enthusiastic participation made the event truly grand. It was a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=5733&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;"><strong><a href="http://blog.sqlauthority.com/2009/06/22/sqlauthority-news-teched-on-road-ahmedabad-june-20-2009-an-astounding-success/" target="_blank">TechEd on Road Ahmedabad</a></strong>, June 20, 2009, was a huge success. This grand event saw over 200 attendees actively participating in the sessions. We had attendees traveling from far and wide, including Delhi, Mumbai, Jaipur, Kerala, Baroda, Himmatnagar, Rajkot, among other cities from India. This enthusiastic participation made the event truly grand. It was a moment of bliss for me as I had not anticipated such tremendous positive response!</p>
<p style="text-align:justify;">Although the Official time to commence the event was at 1:45 PM we were really excited to see the attendees entering the hall before the official time. We were more than happy to quickly arrange a special session for those attendees who came in early to keep them engaged. They won loads of gifts while waiting for the official sessions to start. We had a brainstorming quiz session. I was happy to see that people in Ahmedabad are now taking keen interest in enhancing their knowledge.</p>
<p style="text-align:justify;">One of the questions was &#8211; <strong>What is the maximum number of Index per table? </strong>I received lots of answers to this question but only two answers are correct. Let us now take a look at them.</p>
<p style="text-align:justify;"><strong>For SQL Server 2005:</strong><br />
1 Clustered Index + 249 Nonclustered Index = 250 Index<br />
<a href="http://msdn.microsoft.com/en-us/library/ms143432(SQL.90).aspx" target="_blank">http://msdn.microsoft.com/en-us/library/ms143432(SQL.90).aspx</a></p>
<p style="text-align:justify;"><strong>For SQL Server 2008:</strong><br />
1 Clustered Index + 999 Nonclustered Index = 1000 Index<br />
<a href="http://msdn.microsoft.com/en-us/library/ms143432.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/ms143432.aspx</a>
</p>
<p style="text-align:justify;">I would like to thank one of the attendees of Ahmedabad TechEd Kruti Kansara for the above comment.</p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (<a href="http://blog.sqlauthority.com/" target="_blank">http://blog.SQLAuthority.com</a>)</strong></p>
<br />Posted in Pinal Dave, Readers Contribution, Readers Question, SQL, SQL Authority, SQL Index, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/5733/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/5733/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/5733/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/5733/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/5733/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/5733/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/5733/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/5733/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/5733/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/5733/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=5733&subd=sqlauthority&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/06/29/sql-server-maximum-number-of-index-per-table/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER &#8211; Fix : Error : 17892 Logon failed for login due to trigger execution. Changed database context to &#8216;master&#8217;.</title>
		<link>http://blog.sqlauthority.com/2009/06/27/sql-server-fix-error-17892-logon-failed-for-login-due-to-trigger-execution-changed-database-context-to-master/</link>
		<comments>http://blog.sqlauthority.com/2009/06/27/sql-server-fix-error-17892-logon-failed-for-login-due-to-trigger-execution-changed-database-context-to-master/#comments</comments>
		<pubDate>Sat, 27 Jun 2009 01:30:17 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Error Messages]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Trigger]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[DAC]]></category>
		<category><![CDATA[sqlcmd]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5722</guid>
		<description><![CDATA[I had previously written two articles about an intriguing observation of triggers online.
SQL SERVER – Interesting Observation of Logon Trigger On All Servers
SQL SERVER &#8211; Interesting Observation of Logon Trigger On All Servers &#8211; Solution
If you are wondering what made me write yet another article on logon trigger then let me tell you the story [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=5722&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">I had previously written two articles about an intriguing observation of triggers online.</p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2009/05/27/sql-server-interesting-observation-of-logon-trigger-on-all-servers/" target="_blank">SQL SERVER – Interesting Observation of Logon Trigger On All Servers</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2009/06/26/sql-server-interesting-observation-of-logon-trigger-on-all-servers-solution" target="_blank">SQL SERVER &#8211; Interesting Observation of Logon Trigger On All Servers &#8211; Solution</a></p>
<p>If you are wondering what made me write yet another article on logon trigger then let me tell you the story behind it. One of my readers encountered a situation where he dropped the database created in the above two articles and he was unable to logon to the system after that.</p>
<p>Let us recreate the scenario first and attempt to solve the problem.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:green;">/* Create Audit Database */<br />
</span><span style="color:blue;">CREATE DATABASE </span><span style="color:black;">AuditDb<br />
GO<br />
</span><span style="color:blue;">USE </span><span style="color:black;">AuditDb<br />
GO<br />
</span><span style="color:green;">/* Create Audit Table */<br />
</span><span style="color:blue;">CREATE TABLE </span><span style="color:black;">ServerLogonHistory<br />
</span><span style="color:gray;">(</span><span style="color:black;">SystemUser </span><span style="color:blue;">VARCHAR</span><span style="color:gray;">(</span><span style="color:black;">512</span><span style="color:gray;">),<br />
</span><span style="color:black;">DBUser </span><span style="color:blue;">VARCHAR</span><span style="color:gray;">(</span><span style="color:black;">512</span><span style="color:gray;">),<br />
</span><span style="color:black;">SPID </span><span style="color:blue;">INT</span><span style="color:gray;">,<br />
</span><span style="color:black;">LogonTime DATETIME</span><span style="color:gray;">)<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">/* Create Logon Trigger */<br />
</span><span style="color:blue;">CREATE TRIGGER </span><span style="color:black;">Tr_ServerLogon<br />
</span><span style="color:blue;">ON </span><span style="color:gray;">ALL </span><span style="color:black;">SERVER </span><span style="color:blue;">FOR </span><span style="color:black;">LOGON<br />
</span><span style="color:blue;">AS<br />
BEGIN<br />
INSERT INTO </span><span style="color:black;">AuditDb.dbo.ServerLogonHistory<br />
</span><span style="color:blue;">SELECT </span><span style="color:magenta;">SYSTEM_USER</span><span style="color:gray;">,</span><span style="color:magenta;">USER</span><span style="color:gray;">,</span><span style="color:#434343;">@@SPID</span><span style="color:gray;">,</span><span style="color:magenta;">GETDATE</span><span style="color:gray;">()<br />
</span><span style="color:blue;">END<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">/* Dropping Database AuditDB */<br />
/* Please note login to Server again will<br />
Produce Errors */<br />
</span><span style="color:blue;">USE </span><span style="color:black;">master<br />
GO<br />
</span><span style="color:blue;">DROP DATABASE </span><span style="color:black;">AuditDB<br />
GO</span></code>
</p>
<p style="text-align:justify;">After the database is dropped and we try to login again the following error will be displayed.</p>
<p style="text-align:justify;"><span style="color:#ff0000;">Logon failed for login &#8216;SQL\Pinal&#8217; due to trigger execution.<br />
Changed database context to &#8216;master&#8217;.<br />
Changed language setting to us_english. (Microsoft SQL Server, Error: 17892)</span>
</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/errortrigger.png" alt="" width="555" height="469" /></p>
<p style="text-align:justify;">This error could have been evaded if the Trigger was dropped prior to dropping database.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">master<br />
GO<br />
</span><span style="color:blue;">DROP TRIGGER </span><span style="color:black;">Tr_ServerLogon </span><span style="color:blue;">ON </span><span style="color:gray;">ALL </span><span style="color:black;">SERVER<br />
GO</span></code>
</p>
<p style="text-align:justify;">Now, it will not be possible to logon to the database using SQL Server Management Studio. The only way to fix this problem is using DAC. Read more details about DAC  <a href="http://blog.sqlauthority.com/2009/01/09/sql-server-sqlcmd-using-a-dedicated-administrator-connection-to-kill-currently-running-query/" target="_blank">Using a Dedicated Administrator Connection to Kill Currently Running Query</a>. Now let us take a look at the example in our case where I am using windows authentication to logon to the system.</p>
<p style="text-align:justify;">Connect SQL Server using sqlcmd and -A option, which will establish DAC. Running the following command on command prompt will allow you to login once again in the database. I am specifying argument <em><strong>-d master</strong></em> which will directly enable me to logon to master database when DAC is connected.</p>
<p style="text-align:justify;"><strong>C:\Users\Pinal&gt;sqlcmd -S LocalHost -d master -A<br />
1&gt; DROP TRIGGER Tr_ServerLogon ON ALL SERVER<br />
2&gt; GO</strong>
</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/sqlcmddac.png" alt="" width="477" height="333" /></p>
<p style="text-align:justify;">I hope my explanation on logon triggers, DAC, and sqlcmd is clear to everyone. Let me have your thoughts about my present article.</p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (<a href="http://blog.sqlauthority.com/" target="_blank">http://blog.SQLAuthority.com</a>)</strong></p>
<br />Posted in Pinal Dave, Readers Question, SQL, SQL Authority, SQL Error Messages, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, SQL Trigger, T SQL, Technology Tagged: DAC, sqlcmd <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/5722/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/5722/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/5722/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/5722/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/5722/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/5722/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/5722/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/5722/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/5722/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/5722/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=5722&subd=sqlauthority&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/06/27/sql-server-fix-error-17892-logon-failed-for-login-due-to-trigger-execution-changed-database-context-to-master/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/errortrigger.png" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/sqlcmddac.png" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Order of Hotfix and Service Pack</title>
		<link>http://blog.sqlauthority.com/2009/06/06/sql-server-order-of-hotfix-and-service-pack/</link>
		<comments>http://blog.sqlauthority.com/2009/06/06/sql-server-order-of-hotfix-and-service-pack/#comments</comments>
		<pubDate>Sat, 06 Jun 2009 01:30:57 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Download]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[SQL Service Pack]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5348</guid>
		<description><![CDATA[On an average once a week I receive a question from my readers regarding what should be the sequence of hotfix and service pack. Not long ago, one of my regular readers who is using SQL Server 2000 asked me how can he improve the installation speed as he has to install 4 Service Packs [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=5348&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">On an average once a week I receive a question from my readers regarding what should be the sequence of hotfix and service pack. Not long ago, one of my regular readers who is using SQL Server 2000 asked me how can he improve the installation speed as he has to install 4 Service Packs to upgrade his server to SQL Server SP4 version. All these questions from my readers have prompted me to write down this small note.  I hope this will clear some of the common doubts they have about this subject and they no longer would have to ponder over such issues</p>
<p style="text-align:justify;">You do not need to install all Service Packs to upgrade your server version to the latest versions. <em><strong>Just install Latest Service Pack and Hotfix and you are done!</strong></em></p>
<p style="text-align:justify;">This might be the smallest tip I have given so far on my blog but I am just curious to know from you all if you already knew about the solution or came to know about it through my blog today. Based on your feedback, I will come up with small articles like this in future and solve your day-to-day queries.</p>
<p style="text-align:justify;">All Microsoft Service Packs are listed <a href="http://support.microsoft.com/sp" target="_blank">here</a>.</p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (<a href="http://blog.sqlauthority.com/" target="_blank">http://blog.SQLAuthority.com</a>)</strong></p>
<br />Posted in Pinal Dave, Readers Question, SQL, SQL Authority, SQL Download, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology Tagged: SQL Service Pack <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/5348/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/5348/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/5348/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/5348/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/5348/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/5348/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/5348/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/5348/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/5348/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/5348/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=5348&subd=sqlauthority&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/06/06/sql-server-order-of-hotfix-and-service-pack/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER &#8211; What is Interim Table &#8211; Simple Definition of Interim Table</title>
		<link>http://blog.sqlauthority.com/2009/06/04/sql-server-what-is-interim-table-simple-definition-of-interim-table/</link>
		<comments>http://blog.sqlauthority.com/2009/06/04/sql-server-what-is-interim-table-simple-definition-of-interim-table/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 01:30:54 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Interview Questions and Answers]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQLServer]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5384</guid>
		<description><![CDATA[Sometimes a simple question like &#8220;What is interim table?&#8221; can initiate a never-ending discussion between developers. I experienced this recently while I was on phone helping my friends working in Los Angeles. In a conference call, one of the developers kept on talking about &#8220;first interim table&#8221; and &#8220;second interim table&#8221; and so forth, while [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=5384&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Sometimes a simple question like &#8220;<strong>What is interim table?</strong>&#8221; can initiate a never-ending discussion between developers. I experienced this recently while I was on phone helping my friends working in Los Angeles. In a conference call, one of the developers kept on talking about &#8220;first interim table&#8221; and &#8220;second interim table&#8221; and so forth, while another developer was of the opinion that that there cannot be more than one interim table. Well, as this was not enough a third developer interrupted the debate and said that all the tables are interim tables. The heated discussion seemed never ending.</p>
<p style="text-align:justify;">To put the long story sort, let us today in this blog post try to understand what interim table is and how many possible interim tables are there.</p>
<p style="text-align:justify;">Interim table is a table that is generated by joining two tables and not the final result table. In other words, when two tables are joined they create an interim table as resultset but the resultset is not final yet. It may be possible that more tables are about to join on the interim table, and more operations are still to be applied on that table (e.g. Order By, Having etc). Besides, it may be possible that there is no interim table; sometimes final table is what is generated when query is run.</p>
<p style="text-align:justify;">Let us try to comprehend the above explanation with an example using the following AdventureWorks sample database.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">AdventureWorks</span><span style="color:gray;">;<br />
</span><span style="color:black;">GO<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">*<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">Person.Contact C<br />
</span><span style="color:blue;">INNER JOIN </span><span style="color:black;">Sales.SalesPerson SP<br />
</span><span style="color:blue;">ON </span><span style="color:black;">C.ContactID </span><span style="color:blue;">= </span><span style="color:black;">SP.SalesPersonID<br />
</span><span style="color:blue;">INNER JOIN </span><span style="color:black;">Sales.SalesTerritory ST<br />
</span><span style="color:blue;">ON </span><span style="color:black;">ST.TerritoryID </span><span style="color:blue;">= </span><span style="color:black;">SP.TerritoryID<br />
</span><span style="color:blue;">ORDER BY </span><span style="color:black;">ST.TerritoryID</span><span style="color:gray;">, </span><span style="color:black;">C.LastName<br />
GO</span></code>
</p>
<p style="text-align:justify;"><span style="color:black;"><strong>First Interim Table:</strong></span></p>
<p style="text-align:justify;">When two tables are joined and there are more pending operations then the table is called first interim table.</p>
<p style="text-align:justify;"><span style="color:black;"><img class="alignnone" src="http://www.pinaldave.com/bimg/intrim1.jpg" alt="" width="500" height="466" /></span></p>
<p style="text-align:justify;"><span style="color:black;"><strong>Second InterimTable:</strong></span></p>
<p style="text-align:justify;">When a third table is joined to the first interim table and there are more pending operations then the table is called second interim table.</p>
<p style="text-align:justify;"><span style="color:black;"><img class="alignnone" src="http://www.pinaldave.com/bimg/intrim2.jpg" alt="" width="501" height="461" /></span></p>
<p style="text-align:justify;"><span style="color:black;"><strong>Final Table:</strong></span></p>
<p style="text-align:justify;">After joins, all the remaining database operations are performed on the latest interim table which generates the final table.</p>
<p style="text-align:justify;"><span style="color:black;"><img class="alignnone" src="http://www.pinaldave.com/bimg/intrim3.jpg" alt="" width="500" height="466" /></span></p>
<p style="text-align:justify;">Please let me know if your doubts about interim tables are clear now with this simple and easy-to-read post. If you like the style of this post, I will post many more like this in near future.</p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.sqlauthority.com</strong></a><strong>)</strong></p>
<br />Posted in Pinal Dave, Readers Question, SQL, SQL Authority, SQL Interview Questions and Answers, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, SQLServer, T SQL, Technology  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/5384/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/5384/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/5384/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/5384/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/5384/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/5384/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/5384/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/5384/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/5384/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/5384/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=5384&subd=sqlauthority&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/06/04/sql-server-what-is-interim-table-simple-definition-of-interim-table/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/intrim1.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/intrim2.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/intrim3.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; List All Objects Created on All Filegroups in Database</title>
		<link>http://blog.sqlauthority.com/2009/06/01/sql-server-list-all-objects-created-on-all-filegroups-in-database/</link>
		<comments>http://blog.sqlauthority.com/2009/06/01/sql-server-list-all-objects-created-on-all-filegroups-in-database/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 01:30:51 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Index]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL System Table]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5300</guid>
		<description><![CDATA[When I pen down any article I always keep my readers in my mind. With every topic of SQL server I cover, I try to bring readers closer to this technology. So, whenever I receive follow up questions from my readers I am exhilarated! Sometime back I had covered a topic &#8211; SQL SERVER – [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=5300&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">When I pen down any article I always keep my readers in my mind. With every topic of SQL server I cover, I try to bring readers closer to this technology. So, whenever I receive follow up questions from my readers I am exhilarated! Sometime back I had covered a topic &#8211; <strong><a href="http://blog.sqlauthority.com/2009/05/31/sql-server-create-multiple-filegroup-for-single-database/" target="_blank">SQL SERVER – Create Multiple Filegroup For Single Database</a></strong>, for which I received a number of follow up questions. In this post I would like to discuss on a question from one of the readers Joginder &#8220;Jogi&#8221; Padiyala.</p>
<p style="text-align:justify;"><strong>“How can I find which object belongs to which filegroup. Is there any way to know this?&#8221;</strong></p>
<p style="text-align:justify;">Well, finding out which object belongs to which table is very simple.<br />
Let us first create a database having multiple filegroups.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:green;">/* Create Database<br />
Please note that there are two Filegroups for newly created datbase.<br />
MDF - Primary and LDF on Secondary */<br />
</span><span style="color:blue;">CREATE DATABASE </span><span style="color:black;">[FGTest] </span><span style="color:blue;">ON  PRIMARY<br />
</span><span style="color:gray;">( </span><span style="color:black;">NAME </span><span style="color:blue;">= </span><span style="color:red;">N'FGTest'</span><span style="color:gray;">,<br />
</span><span style="color:black;">FILENAME </span><span style="color:blue;">= </span><span style="color:red;">N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\FGTest.mdf' </span><span style="color:gray;">,<br />
</span><span style="color:black;">SIZE </span><span style="color:blue;">= </span><span style="color:black;">3072KB </span><span style="color:gray;">, </span><span style="color:black;">FILEGROWTH </span><span style="color:blue;">= </span><span style="color:black;">1024KB </span><span style="color:gray;">),<br />
</span><span style="color:black;">FILEGROUP [Secondary]<br />
</span><span style="color:gray;">( </span><span style="color:black;">NAME </span><span style="color:blue;">= </span><span style="color:red;">N'FGTest_2'</span><span style="color:gray;">,<br />
</span><span style="color:black;">FILENAME </span><span style="color:blue;">= </span><span style="color:red;">N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\FGTest_2.ndf' </span><span style="color:gray;">,<br />
</span><span style="color:black;">SIZE </span><span style="color:blue;">= </span><span style="color:black;">3072KB </span><span style="color:gray;">, </span><span style="color:black;">FILEGROWTH </span><span style="color:blue;">= </span><span style="color:black;">1024KB </span><span style="color:gray;">)<br />
</span><span style="color:magenta;">LOG </span><span style="color:blue;">ON<br />
</span><span style="color:gray;">( </span><span style="color:black;">NAME </span><span style="color:blue;">= </span><span style="color:red;">N'FGTest_log'</span><span style="color:gray;">,<br />
</span><span style="color:black;">FILENAME </span><span style="color:blue;">= </span><span style="color:red;">N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\FGTest_log.ldf' </span><span style="color:gray;">,<br />
</span><span style="color:black;">SIZE </span><span style="color:blue;">= </span><span style="color:black;">1024KB </span><span style="color:gray;">, </span><span style="color:black;">FILEGROWTH </span><span style="color:blue;">= </span><span style="color:black;">10</span><span style="color:gray;">%)<br />
</span><span style="color:black;">GO</span></code>
</p>
<p style="text-align:justify;">Now create a table on primary filegroup.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:green;">/* Create New table on Primary Filgroup */<br />
</span><span style="color:blue;">USE </span><span style="color:black;">[FGTest]<br />
GO<br />
</span><span style="color:blue;">CREATE TABLE </span><span style="color:black;">[dbo].[TestTable]</span><span style="color:gray;">(<br />
</span><span style="color:black;">[ID] [int] </span><span style="color:gray;">NOT NULL,<br />
</span><span style="color:black;">[Col1] [varchar]</span><span style="color:gray;">(</span><span style="color:black;">50</span><span style="color:gray;">) NOT NULL,<br />
</span><span style="color:black;">[Col2] [varchar]</span><span style="color:gray;">(</span><span style="color:black;">50</span><span style="color:gray;">) NOT NULL,<br />
</span><span style="color:blue;">CONSTRAINT </span><span style="color:black;">[PK_TestTable] </span><span style="color:blue;">PRIMARY KEY CLUSTERED<br />
</span><span style="color:gray;">(<br />
</span><span style="color:black;">[ID] </span><span style="color:blue;">ASC<br />
</span><span style="color:gray;">)<br />
) </span><span style="color:blue;">ON </span><span style="color:black;">[PRIMARY]<br />
GO</span></code>
</p>
<p style="text-align:justify;">Next, create non-clustered index on secondary filegroup.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:green;">/* Create Non Clustered Index on Secondary FileGroup */<br />
</span><span style="color:blue;">CREATE NONCLUSTERED INDEX </span><span style="color:black;">[IX_TestTable_Second] </span><span style="color:blue;">ON </span><span style="color:black;">[dbo].[TestTable]<br />
</span><span style="color:gray;">(<br />
</span><span style="color:black;">[Col1] </span><span style="color:blue;">ASC<br />
</span><span style="color:gray;">) </span><span style="color:blue;">ON </span><span style="color:black;">[Secondary]<br />
GO</span></code>
</p>
<p style="text-align:justify;">After that, we will run the following T-SQL and determine where all the objects are located on filegroup. We have already created a non-clustered index on our table. Now, non-clustered table creates its own table, which consists of pointers to clustered index. For the same reason, we will search with additional condition of object type, which will list only user created tables. Non- clustered table should be part of user created table group.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:green;">/* Get Details of Object on different filegroup<br />
Finding User Created Tables*/<br />
</span><span style="color:blue;">SELECT </span><span style="color:black;">o.[name]</span><span style="color:gray;">, </span><span style="color:black;">o.[type]</span><span style="color:gray;">, </span><span style="color:black;">i.[name]</span><span style="color:gray;">, </span><span style="color:black;">i.[index_id]</span><span style="color:gray;">, </span><span style="color:black;">f.[name]<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">sys.indexes i<br />
</span><span style="color:blue;">INNER JOIN </span><span style="color:black;">sys.filegroups f<br />
</span><span style="color:blue;">ON </span><span style="color:black;">i.data_space_id </span><span style="color:blue;">= </span><span style="color:black;">f.data_space_id<br />
</span><span style="color:blue;">INNER JOIN </span><span style="color:black;">sys.all_objects o<br />
</span><span style="color:blue;">ON </span><span style="color:black;">i.[object_id] </span><span style="color:blue;">= </span><span style="color:black;">o.[object_id]<br />
</span><span style="color:blue;">WHERE </span><span style="color:black;">i.data_space_id </span><span style="color:blue;">= </span><span style="color:black;">f.data_space_id<br />
</span><span style="color:gray;">AND </span><span style="color:black;">o.type </span><span style="color:blue;">= </span><span style="color:red;">'U' </span><span style="color:green;">-- User Created Tables<br />
</span><span style="color:black;">GO</span></code>
</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/fg1.jpg" alt="" width="502" height="311" /></p>
<p style="text-align:justify;">Let us observe the same query again with different WHERE condition. Here we are retrieving everything that is on secondary filegroup. It is very easy to identify filegroup name and data by just selecting everything from system table sys.filegroups.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:green;">/* Get Detail about Filegroups */<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">*<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">sys.filegroups<br />
GO </span></code>
</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/fg3.jpg" alt="" width="388" height="178" /></p>
<p style="text-align:justify;">In our case, secondary filegroup has data_space_id as 2. Now, we will run the following query and figure out which objects are located on filegroup 2.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:green;">/* Get Details of Object on different filegroup<br />
Finding Objects on Specific Filegroup*/<br />
</span><span style="color:blue;">SELECT </span><span style="color:black;">o.[name]</span><span style="color:gray;">, </span><span style="color:black;">o.[type]</span><span style="color:gray;">, </span><span style="color:black;">i.[name]</span><span style="color:gray;">, </span><span style="color:black;">i.[index_id]</span><span style="color:gray;">, </span><span style="color:black;">f.[name]<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">sys.indexes i<br />
</span><span style="color:blue;">INNER JOIN </span><span style="color:black;">sys.filegroups f<br />
</span><span style="color:blue;">ON </span><span style="color:black;">i.data_space_id </span><span style="color:blue;">= </span><span style="color:black;">f.data_space_id<br />
</span><span style="color:blue;">INNER JOIN </span><span style="color:black;">sys.all_objects o<br />
</span><span style="color:blue;">ON </span><span style="color:black;">i.[object_id] </span><span style="color:blue;">= </span><span style="color:black;">o.[object_id]<br />
</span><span style="color:blue;">WHERE </span><span style="color:black;">i.data_space_id </span><span style="color:blue;">= </span><span style="color:black;">f.data_space_id<br />
</span><span style="color:gray;">AND </span><span style="color:black;">i.data_space_id </span><span style="color:blue;">= </span><span style="color:black;">2 </span><span style="color:green;">-- Filegroup<br />
</span><span style="color:black;">GO</span></code>
</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/fg2.jpg" alt="" width="502" height="300" /></p>
<p style="text-align:justify;">I hope this answers Jogi&#8217;s question and is helpful for those who were curious to know the answer to this topic.</p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (<a href="http://blog.sqlauthority.com/" target="_blank">http://blog.SQLAuthority.com</a>)</strong></p>
<br />Posted in Pinal Dave, Readers Question, SQL, SQL Authority, SQL Index, SQL Query, SQL Scripts, SQL Server, SQL System Table, SQL Tips and Tricks, T SQL, Technology  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/5300/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/5300/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/5300/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/5300/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/5300/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/5300/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/5300/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/5300/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/5300/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/5300/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=5300&subd=sqlauthority&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/06/01/sql-server-list-all-objects-created-on-all-filegroups-in-database/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/fg1.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/fg3.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/fg2.jpg" medium="image" />
	</item>
	</channel>
</rss>