<?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>Sat, 21 Nov 2009 01:30:19 +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://s.wordpress.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>
			<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[<div class='snap_preview'><br /><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>
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" /></div>]]></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>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_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[<div class='snap_preview'><br /><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>
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" /></div>]]></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[<div class='snap_preview'><br /><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>
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" /></div>]]></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>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/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[<div class='snap_preview'><br /><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>
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" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/09/06/sql-server-find-gaps-in-the-sequence/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 &#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[<div class='snap_preview'><br /><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>
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" /></div>]]></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[<div class='snap_preview'><br /><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>
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" /></div>]]></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[<div class='snap_preview'><br /><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>
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" /></div>]]></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[<div class='snap_preview'><br /><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>
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" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/07/30/sqlauthority-news-authors-birthday-top-7-commenters-volunteers/feed/</wfw:commentRss>
		<slash:comments>34</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[<div class='snap_preview'><br /><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>
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" /></div>]]></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>33</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[<div class='snap_preview'><br /><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>
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" /></div>]]></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>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>
	</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[<div class='snap_preview'><br /><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>
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" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/06/29/sql-server-maximum-number-of-index-per-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>
	</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[<div class='snap_preview'><br /><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>
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" /></div>]]></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>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>

		<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[<div class='snap_preview'><br /><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>
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" /></div>]]></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[<div class='snap_preview'><br /><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>
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" /></div>]]></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[<div class='snap_preview'><br /><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>
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" /></div>]]></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>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/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>
		<item>
		<title>SQL SERVER &#8211; Create Multiple Filegroup For Single Database</title>
		<link>http://blog.sqlauthority.com/2009/05/31/sql-server-create-multiple-filegroup-for-single-database/</link>
		<comments>http://blog.sqlauthority.com/2009/05/31/sql-server-create-multiple-filegroup-for-single-database/#comments</comments>
		<pubDate>Sun, 31 May 2009 01:30:35 +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 Server]]></category>
		<category><![CDATA[SQL Server Management Studio]]></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=5285</guid>
		<description><![CDATA[I am elated to receive hundreds of emails every day from my readers. My tight work schedule refrains me from answering all your questions, but I do try my best to entertain them whenever I can. Today&#8217;s post revolves around a question I received a number of times last year but never blogged on it. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=5285&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I am elated to receive hundreds of emails every day from my readers. My tight work schedule refrains me from answering all your questions, but I do try my best to entertain them whenever I can. Today&#8217;s post revolves around a question I received a number of times last year but never blogged on it. On positive side, you are reading about that interesting subject today.</p>
<p>The question is &#8211; <strong>How to create multiple filegroup for any database?</strong></p>
<p>To find solution to this query, we will go through the following four cases.</p>
<p>1) Creating New Database</p>
<p style="padding-left:30px;">a) Using T-SQL<br />
b) Using SSMS</p>
<p>2) Updating Existing Database and Adding Filegroup
</p>
<p style="padding-left:30px;">a) Using T-SQL<br />
b) Using SSMS</p>
<p>Let us go over each of the cases one by one.</p>
<p><strong>1) Creating New Database</strong><br />
<strong>a) Using T-SQL</strong></p>
<p><code style="font-size:12px;"><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><code style="font-size:12px;"><span style="color:black;"> </span></code><strong>b) Using SSMS</strong></p>
<p><strong><img class="alignnone" src="http://www.pinaldave.com/bimg/ndf1.jpg" alt="" width="500" height="380" /></strong></p>
<p><strong><img class="alignnone" src="http://www.pinaldave.com/bimg/ndf2.jpg" alt="" width="500" height="380" /></strong></p>
<p><strong><img class="alignnone" src="http://www.pinaldave.com/bimg/ndf3.jpg" alt="" width="396" height="254" /></strong></p>
<p><strong><img class="alignnone" src="http://www.pinaldave.com/bimg/ndf4.jpg" alt="" width="500" height="380" /></strong></p>
<p><strong>2) Updating Existing Database and Adding Filegroup</strong></p>
<p>Updating existing database is much simpler compared with adding filegroup to new database. Let us take a look at how quickly it can be completed in a few simple steps.</p>
<p><strong>a) Using T-SQL</strong><br />
We will add a Third filegroup to the same database where we added secondary filegroup in the above example.</p>
<p><code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">[master]<br />
GO<br />
</span><span style="color:blue;">ALTER DATABASE </span><span style="color:black;">[FGTest] </span><span style="color:blue;">ADD </span><span style="color:black;">FILEGROUP [Third]<br />
GO </span></code></p>
<p><strong>b) Using SSMS<br />
</strong>Right click on the database and go to properties and filegroup. Add new filegroup by simply adding name.</p>
<p><strong><span style="font-weight:normal;"><img class="alignnone" src="http://www.pinaldave.com/bimg/ndf5.jpg" alt="" width="500" height="449" /></span></strong></p>
<p>I encourage all my readers to keep mailing me send in your questions and doubts. I will certainly take them up at some point of time.</p>
<p>Reference : <strong>Pinal Dave (<a href="http://blog.sqlauthority.com/" target="_blank">http://blog.SQLAuthority.com</a>)</strong></p>
Posted in Pinal Dave, Readers Question, SQL, SQL Authority, SQL Query, SQL Scripts, SQL Server, SQL Server Management Studio, SQL Tips and Tricks, T SQL, Technology  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/5285/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/5285/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/5285/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/5285/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/5285/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/5285/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/5285/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/5285/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/5285/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/5285/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=5285&subd=sqlauthority&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/05/31/sql-server-create-multiple-filegroup-for-single-database/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/ndf1.jpg" medium="image" />

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

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

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

		<media:content url="http://www.pinaldave.com/bimg/ndf5.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; How to Drop Temp Table &#8211; Check Existence of Temp Table</title>
		<link>http://blog.sqlauthority.com/2009/05/17/sql-server-how-to-drop-temp-table-check-existence-of-temp-table/</link>
		<comments>http://blog.sqlauthority.com/2009/05/17/sql-server-how-to-drop-temp-table-check-existence-of-temp-table/#comments</comments>
		<pubDate>Sun, 17 May 2009 01:30:49 +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 Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQLServer]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[SQL TempDB]]></category>
		<category><![CDATA[Temp Table]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=4936</guid>
		<description><![CDATA[I have received following questions numerous times:
&#8220;How to check existence of Temp Table in SQL Server Database?&#8221;
&#8220;How to drop Temp Table from TempDB?&#8221;
&#8220;When I try to drop Temp Table I get following error. Msg 2714, Level 16, State 6, Line 4
There is already an object named ‘#temp’ in the database. How can I fix it?&#8221;

&#8220;Can [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=4936&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:justify;">I have received following questions numerous times:</p>
<p style="text-align:justify;">&#8220;How to check existence of Temp Table in SQL Server Database?&#8221;</p>
<p style="text-align:justify;">&#8220;How to drop Temp Table from TempDB?&#8221;</p>
<p style="text-align:justify;">&#8220;When I try to drop Temp Table I get following error. <em><span style="color:#ff6666;">Msg 2714, Level 16, State 6, Line 4</span><br />
<span style="color:#ff6666;">There is already an object named ‘#temp’ in the database. </span></em>How can I fix it?&#8221;
</p>
<p style="text-align:justify;">&#8220;Can we have only one Temp Table or we can have multiple Temp Table?&#8221;</p>
<p style="text-align:justify;">&#8220;I have SP using Temp Table, when it will run simultaneously, will it overwrite data of temp table?&#8221;</p>
<p style="text-align:justify;">In fact I have already answer this question earlier in one of my blog post. I have even explained how Temp Table works in TempDB and how they are managed.</p>
<p style="text-align:justify;">Visit my earlier written article for answers to questions listed above.</p>
<h3 style="text-align:justify;"><a href="http://blog.sqlauthority.com/2009/03/29/sql-server-fix-error-msg-2714-level-16-state-6-there-is-already-an-object-named-temp-in-the-database/" target="_blank">SQL SERVER &#8211; Fix : Error : Msg 2714, Level 16, State 6 &#8211; There is already an object named ‘#temp’ in the database</a></h3>
<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>
Posted in Pinal Dave, Readers Question, SQL, SQL Authority, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, SQLServer, T SQL, Technology Tagged: SQL TempDB, Temp Table <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/4936/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/4936/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/4936/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/4936/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/4936/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/4936/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/4936/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/4936/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/4936/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/4936/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=4936&subd=sqlauthority&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/05/17/sql-server-how-to-drop-temp-table-check-existence-of-temp-table/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; Find Last Date Time Updated for Any Table</title>
		<link>http://blog.sqlauthority.com/2009/05/09/sql-server-find-last-date-time-updated-for-any-table/</link>
		<comments>http://blog.sqlauthority.com/2009/05/09/sql-server-find-last-date-time-updated-for-any-table/#comments</comments>
		<pubDate>Sat, 09 May 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 DateTime]]></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=4940</guid>
		<description><![CDATA[I just received an email from one of my regular readers who is curious to know if there is any way to find out when a table is recently updated. I was ready with my answer! I promptly suggested him that if a table contains UpdatedDate or ModifiedDate date column with default together with value [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=4940&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:justify;">I just received an email from one of my regular readers who is curious to know if there is any way to find out when a table is recently updated. I was ready with my answer! I promptly suggested him that if a table contains UpdatedDate or ModifiedDate date column with default together with value GETDATE(), he should make use of it. On close observation the table is not required to keep history when any row is inserted. However, the sole prerequisite is to be aware of when any table has been updated. That’s it!</p>
<p style="text-align:justify;">If a user wants to finds out when was the last table updated he can query dynamic management view (dmv) &#8211; sys.dm_db_index_usage_stats and easily figure out when was the table updated last. Let us comprehend this example by creating a table and updating it. We can use dmv to determine when it was updated last.</p>
<p><code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">AdventureWorks<br />
GO<br />
</span><span style="color:blue;">CREATE TABLE </span><span style="color:black;">Test<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;">COL </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;">INSERT INTO </span><span style="color:black;">Test<br />
</span><span style="color:blue;">SELECT </span><span style="color:black;">1</span><span style="color:gray;">,</span><span style="color:red;">'First'<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;">2</span><span style="color:gray;">,</span><span style="color:red;">'Second'<br />
</span><span style="color:black;">GO</span></code></p>
<p style="text-align:justify;">Now we have created a table and populated it with data. Next, we will run the following query to find out when it was last updated.</p>
<p><code style="font-size:12px;"><span style="color:blue;">SELECT </span><span style="color:magenta;">OBJECT_NAME</span><span style="color:gray;">(</span><span style="color:magenta;">OBJECT_ID</span><span style="color:gray;">) </span><span style="color:blue;">AS </span><span style="color:black;">DatabaseName</span><span style="color:gray;">, </span><span style="color:black;">last_user_update</span><span style="color:gray;">,*<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">sys.dm_db_index_usage_stats<br />
</span><span style="color:blue;">WHERE </span><span style="color:black;">database_id </span><span style="color:blue;">= </span><span style="color:magenta;">DB_ID</span><span style="color:gray;">( </span><span style="color:red;">'AdventureWorks'</span><span style="color:gray;">)<br />
AND </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;">'test'</span><span style="color:gray;">)</span></code></p>
<p style="text-align:justify;">Running query provides accurate details of when was  the table last updated. If WHERE condition is entirely removed it will provide details of the entire database.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/lastupdated.jpg" alt="" width="500" height="502" /></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>
Posted in Pinal Dave, Readers Question, SQL, SQL Authority, SQL DateTime, 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/4940/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/4940/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/4940/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/4940/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/4940/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/4940/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/4940/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/4940/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/4940/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/4940/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=4940&subd=sqlauthority&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/05/09/sql-server-find-last-date-time-updated-for-any-table/feed/</wfw:commentRss>
		<slash:comments>15</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/lastupdated.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; FIX : ERROR :  is not a valid Win32 application. (Exception from HRESULT: 0&#215;800700C1)</title>
		<link>http://blog.sqlauthority.com/2009/04/30/sql-server-fix-error-is-not-a-valid-win32-application-exception-from-hresult-0x800700c1/</link>
		<comments>http://blog.sqlauthority.com/2009/04/30/sql-server-fix-error-is-not-a-valid-win32-application-exception-from-hresult-0x800700c1/#comments</comments>
		<pubDate>Thu, 30 Apr 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 Error Messages]]></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>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=4760</guid>
		<description><![CDATA[Just a day ago, one of my friend sent me email requesting help with following error:
is not a valid Win32 application. (Exception from HRESULT: 0&#215;800700C1)
In fact this is not SQL Server error but it is of .NET application. The solution of this error is just changing configuration of IIS7.
Fix/Solution/Workaround:
Go to IIS.
Click on Application Pool.
Look for [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=4760&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:justify;">Just a day ago, one of my friend sent me email requesting help with following error:</p>
<p style="text-align:justify;"><span style="color:#ff0000;">is not a valid Win32 application. (Exception from HRESULT: 0&#215;800700C1)</span></p>
<p style="text-align:justify;">In fact this is not SQL Server error but it is of .NET application. The solution of this error is just changing configuration of IIS7.</p>
<p style="text-align:justify;"><strong>Fix/Solution/Workaround:</strong></p>
<p style="text-align:justify;">Go to IIS.<br />
Click on Application Pool.<br />
Look for your web application in application pool.<br />
Go to Advanced Settings by right clicking on previously selected application pool.<br />
Enable 32-Bit Applications by checking it.
</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>
Posted in Pinal Dave, Readers Question, SQL, SQL Authority, SQL Error Messages, SQL Query, SQL Security, SQL Server, SQL Tips and Tricks, T SQL, Technology  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/4760/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/4760/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/4760/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/4760/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/4760/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/4760/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/4760/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/4760/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/4760/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/4760/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=4760&subd=sqlauthority&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/04/30/sql-server-fix-error-is-not-a-valid-win32-application-exception-from-hresult-0x800700c1/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>SQLAuthority News &#8211; Starting the SQL Journey &#8211; How Did I Get Started With SQL?</title>
		<link>http://blog.sqlauthority.com/2009/04/27/sqlauthority-news-starting-the-sql-journey-how-did-i-get-started-with-sql/</link>
		<comments>http://blog.sqlauthority.com/2009/04/27/sqlauthority-news-starting-the-sql-journey-how-did-i-get-started-with-sql/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 01:30:30 +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[SQLServer]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=4527</guid>
		<description><![CDATA[This is the very first time I am answering any online tag. SQL Expert Jorge Segarra (a.k.a @SQLChicken) recently tagged me with a very simple yet significant question related to my journey on the path of SQL Server. Let me introduce you all to Jorge first before moving on to his question.
Jorge lives in Tampa, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=4527&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:justify;">This is the very first time I am answering any online tag. SQL Expert <strong><a href="http://sqlchicken.blogspot.com/" target="_blank">Jorge Segarra</a></strong> (a.k.a <strong><a href="http://twitter.com/SQLChicken" target="_blank">@SQLChicken</a></strong>) recently <a href="http://sqlchicken.blogspot.com/2009/04/starting-sql-journey-part-i.htmlhttp://sqlchicken.blogspot.com/2009/04/starting-sql-journey-part-i.html" target="_blank">tagged me</a> with a very simple yet significant question related to my journey on the path of SQL Server. Let me introduce you all to Jorge first before moving on to his question.</p>
<p style="text-align:justify;">Jorge lives in Tampa, Florida, with his beautiful wife, an adorable dog and two naughty cats. He is currently working as a SQL DBA and system administrator for the University Community Hospital. His in-depth knowledge of SQL Server and comprehensive understanding of the subject has gained him incredible popularity in the online world.</p>
<p style="text-align:justify;">Now, his question is &#8211; <strong>how did I get started with SQL</strong>?<br />
Let me try to answer this question on <strong>how did I get started with SQL</strong>.
</p>
<p style="text-align:justify;"><strong>History: </strong></p>
<p style="text-align:justify;">I am currently located in <strong>Ahmedabad, Gujarat, India </strong> and working as a SQL Expert. My specialty is <strong>Query Optimization</strong> and <strong>Database Architecture</strong>. I take SQL Server Tutorial Tracks in all over India. I was in USA for about 7 years before returning back to my roots – India.</p>
<p style="text-align:justify;">I earned my Masters degree from the <strong>University of Southern California</strong> (<a href="http://www.usc.edu/" target="_blank">USC</a>) &#8211; Los Angeles, California, USA. My area of expertise was <strong>Masters of Science</strong> in <strong>Computer Networks</strong> and yes, I am still good at networking even after so many years! I owe my success as a Database Architecture to my strong background in network architecture. My comprehensive understanding of system architecture and network system gives me an edge in all aspects of my professional career. And today, I am capable of providing unorthodox solutions to my domain-related issues!</p>
<p style="text-align:justify;">I have worked in <strong>Las Vegas</strong> in a leading automotive industry as a Database Administrator. During this tenure, I learned a great deal of database optimization and system architecture. If the name “Las Vegas” brings into your mind an obvious question &#8211; Did I ever gamble over there? Well, let me clarify &#8211; I never did!</p>
<p style="text-align:justify;"><strong>Beginning with SQL:</strong></p>
<p style="text-align:justify;">My first job was as a Student Worker in USC where I had to deal with VB desktop application and MS Access. This was my very first experience of working on real working application using SQL. Initially, SQL was all Greek to me, but that was just the beginning. I kept on learning a bit here and there, but till now I did not yet realize the full potential of SQL. Instead of using SQL power to do complex logic, I was using application to do many of those.</p>
<p style="text-align:justify;"><strong>First Job as DBA:</strong></p>
<p style="text-align:justify;">When I got my job in Las Vegas in a leading automotive industry as a developer, it was a serious place for any developer to work in. We had intense SQL Server centric environment, and there was no option but to learn SQL Server 100%. Once it happened that a Sr. DBA resigned from his current job abruptly. Our employer was looking for someone with MCDBA certification. I took my chances and got through two exams of SQL Server (<strong>70-228 and 70-229</strong>) in less than 14 days from the day of advertisement. Not to forget that I got the job of Sr. DBA! I passed few more certifications and developed expertise in Query Optimization and Performance Tuning.</p>
<p style="text-align:justify;"><strong>Beginning SQLAuthority.com:</strong></p>
<p style="text-align:justify;">During my career as a DBA, I often encountered many issues and found their solutions. At the beginning it was difficult to remember everything, so I started to keep my personal bookmark on this blog. In fact, my personal bookmark hosting was the only purpose of starting this blog. You can more details about it on this blog, so I’ll move further.</p>
<p style="text-align:justify;"><strong>Present:</strong></p>
<p style="text-align:justify;">
<p style="text-align:justify;">I returned to India just about 14 months ago to stay with my family. The past 14 months have been extremely special for me. This period saw occurrence of two important events of my life. One, I was awarded with <strong><a href="http://blog.sqlauthority.com/2008/07/01/sqlauthority-news-microsoft-most-valuable-professional-award-for-sql-server-mvp/" target="_blank">Microsoft MVP Award</a></strong>. Second, and most important, <strong><a href="http://blog.sqlauthority.com/2008/12/15/sqlauthority-news-wedding-day-of-author-photographs/" target="_blank">I got married</a></strong> to the girl of my life. Today, I am completely satisfied and happy with my progress and I am planning to continue my journey in SQL Server and database architecture.</p>
<p style="text-align:justify;">For me, learning is a never-ending process and I think there is so much to learn. I still have a long way to go before I can call myself SQL Guru. I am looking forward to meeting some great SQL Gods in MVP Summit.</p>
<p style="text-align:justify;"><strong>I Tag:</strong></p>
<p style="text-align:justify;">I tag my future. I hope that in future, I will be able to actively help my community in a better way and write another note like I’ve written today.</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>
<p style="text-align:justify;">Source : <a href="http://blog.sqlauthority.com/2009/04/27/sqlauthority-news-starting-the-sql-journey-how-did-i-get-started-with-sql/" target="_blank">http://blog.sqlauthority.com/2009/04/27/sqlauthority-news-starting-the-sql-journey-how-did-i-get-started-with-sql/</a><strong><br />
</strong></p>
Posted in About Me, Pinal Dave, Readers Question, SQL, SQL Authority, SQL Query, SQL Server, SQL Tips and Tricks, SQLAuthority News, SQLServer, T SQL, Technology  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/4527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/4527/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/4527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/4527/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/4527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/4527/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/4527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/4527/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/4527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/4527/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=4527&subd=sqlauthority&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/04/27/sqlauthority-news-starting-the-sql-journey-how-did-i-get-started-with-sql/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>
	</item>
	</channel>
</rss>