<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>JohnSterrett.com &#187; SQL Server 2008</title>
	<atom:link href="http://johnsterrett.com/category/sql2008/feed/" rel="self" type="application/rss+xml" />
	<link>http://johnsterrett.com</link>
	<description>This is a one stop shop for free technical blogs about Database Managment and Software Development.  I will also include posts on whats going on with my personal life too...</description>
	<lastBuildDate>Thu, 26 Aug 2010 14:00:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Recap: PGH.NET August 2010 Meeting</title>
		<link>http://johnsterrett.com/2010/08/12/recap-pgh-net-august-2010-meeting/</link>
		<comments>http://johnsterrett.com/2010/08/12/recap-pgh-net-august-2010-meeting/#comments</comments>
		<pubDate>Thu, 12 Aug 2010 13:00:07 +0000</pubDate>
		<dc:creator>johnsterrett</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQLServerPedia Syndication]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[PGH.NET]]></category>
		<category><![CDATA[Presentation]]></category>
		<category><![CDATA[Table Value Parameters]]></category>

		<guid isPermaLink="false">http://johnsterrett.com/?p=292</guid>
		<description><![CDATA[On August 10th 2010 I attended and presented at the PGH.NET User Group meeting named &#8220;5 Guys with Code.&#8221;  According to one of the PGH.NET leaders tweet it looks like the headcount was 60+ The following are some thoughts and highlights from the presentations. Presentations   John Sterrett (Blog &#124; Twitter) &#8211; Table Value Parameters [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjohnsterrett.com%2F2010%2F08%2F12%2Frecap-pgh-net-august-2010-meeting%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjohnsterrett.com%2F2010%2F08%2F12%2Frecap-pgh-net-august-2010-meeting%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>On August 10th 2010 I attended and presented at the <a href="http://codecamppgh.com/default.aspx">PGH.NET User Group</a> meeting named &#8220;5 Guys with Code.&#8221;  According to one of the PGH.NET leaders tweet it looks like the headcount was 60+</p>
<p><a href="http://johnsterrett.com/wp-content/uploads/2010/08/TwitterDavidHoersterbrittrkingAwesomemtgla.png"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="Twitter  David Hoerster @brittrking Awesome mtg la .." src="http://johnsterrett.com/wp-content/uploads/2010/08/TwitterDavidHoersterbrittrkingAwesomemtgla.._thumb.png" border="0" alt="Twitter  David Hoerster @brittrking Awesome mtg la .." width="244" height="118" /></a></p>
<p>The following are some thoughts and highlights from the presentations.</p>
<h3>Presentations</h3>
<ul>
<li> 
<ul>
<li><strong>John Sterrett (<a href="http://johnsterrett.com/">Blog</a> | <a href="http://twitter.com/johnsterrett">Twitter</a>) &#8211; Table Value Parameters with SQL Server 2008 and Microsoft .NET</strong>  </li>
</ul>
<ul>
<li> 
<ul>
<li>Download sample code and presentation <a href="http://johnsterrett.com/presentations/">here</a>.</li>
<li>Download <a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=fffaad6a-0153-4d41-b289-a3ed1d637c0d">SQL Server 2008 R2 Developer Toolkit</a></li>
<li>Download <a href="http://www.microsoft.com/downloads/details.aspx?familyid=E9C68E1B-1E0E-4299-B498-6AB3CA72A6D7&amp;displaylang=en">SQL Server 2008 Developer Toolkit here</a></li>
<li>Table Value Parameter <a href="http://delicious.com/jsterrett/tvp">links</a></li>
</ul>
</li>
</ul>
</li>
<p>I presented a feature that is included in SQL Server 2008 and underused by many developers.  This presentation shows developers how to pass a  DataTable, DataReaders and Lists to SQL Server database objects with only two extra lines of C# or VB.NET code. </p>
<p>As promised below are some reference links</p>
<li><strong>David Hoerster (</strong><a href="http://geekswithblogs.net/DavidHoerster/Default.aspx"><strong>Blog</strong></a><strong> | </strong><a href="http://twitter.com/DavidHoerster"><strong>Twitter</strong></a><strong>) &#8211; jQuery Code Snippets in Visual Studio 2010</strong></li>
</ul>
<p>Time is money and David’s fifteen minute tip might just save you a lot of time and money.    He covered several tools that will help you generate some awesome JavaScript. </p>
<p>I  really liked the <a href="http://jsfiddle.net/">jsFiddle.NET</a> tool.  It looks like a great tool to mockup some a user interface (more on user interfaces later).</p>
<ul>
<li><strong>Rich Dudley (</strong><a href="http://helpcentral.componentone.com/CS/evangelists/b/rich_dudley/default.aspx"><strong>Blog</strong></a><strong>  | </strong><a href="http://twitter.com/rj_dudley"><strong>Twitter</strong></a><strong> ) &#8211; A Quick Look at the New SQL CE Engine</strong></li>
</ul>
<p>Being addicted to databases I very happy to see that I wasn’t the only one presenting a topic based on databases.  Rich did a great job explaining what SQL CE can do and what it cannot do. </p>
<p>Rich <a href="http://helpcentral.componentone.com/CS/evangelists/b/rich_dudley/archive/2010/08/11/recap-pittsburgh-net-ug-swag-a-palooza-2010-08-10.aspx">blogged about his experience</a> (post includes photos, slides and more)</p>
<ul>
<li><strong>John Hidey (</strong><a href="http://sharpdudes.com/blog/"><strong>Blog</strong></a><strong> | </strong><a href="http://twitter.com/johnhidey"><strong>Twitter</strong></a><strong>) &#8211; Layout Controls for XAML</strong></li>
</ul>
<p>I have to admit that XAML and I don’t get along well.  We had a fling a few years ago.  XAML cheated on me and I haven’t been the same since.</p>
<p>Ok seriously, I tried XAML a few times and found it very hard to understand.  John did a great job going over the common things that are hard to understand when you get started with XAML.   John started with some very basic controls and then built a final example that included all the basic controls.</p>
<ul>
<li><strong>Eric Kepes (</strong><a href="http://erickepes.com/"><strong>Blog</strong></a><strong> | </strong><a href="http://twitter.com/ekepes"><strong>Twitter</strong></a><strong>) &#8211; Bowling for TDD</strong></li>
</ul>
<p>At this summers PGH.NET Code Camp we had a speakers session where one of the presenters said, “Code is considered legacy code when TDD is not applied.”  Eric bowling for TDD example showed how anyone can start developing TDD.</p>
]]></content:encoded>
			<wfw:commentRss>http://johnsterrett.com/2010/08/12/recap-pgh-net-august-2010-meeting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Moving SharePoint to the data center</title>
		<link>http://johnsterrett.com/2010/08/03/moving-sharepoint-to-the-data-center/</link>
		<comments>http://johnsterrett.com/2010/08/03/moving-sharepoint-to-the-data-center/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 13:44:33 +0000</pubDate>
		<dc:creator>johnsterrett</dc:creator>
				<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQLServerPedia Syndication]]></category>
		<category><![CDATA[HA]]></category>
		<category><![CDATA[Log Shipping]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[VLDB]]></category>

		<guid isPermaLink="false">http://johnsterrett.com/?p=249</guid>
		<description><![CDATA[I cannot speak for the whole legal industry but where I work a lot of people love some SharePoint.  It’s like 50 Cent says, “We love SharePoint like a fat kid loves cake.”  And trust me we love some cake.  With this mad love of SharePoint comes great collaboration and with this great collaboration comes tons of [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjohnsterrett.com%2F2010%2F08%2F03%2Fmoving-sharepoint-to-the-data-center%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjohnsterrett.com%2F2010%2F08%2F03%2Fmoving-sharepoint-to-the-data-center%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>I cannot speak for the whole legal industry but where I work a lot of people love some SharePoint.  It’s like 50 Cent says, “We love SharePoint like a fat kid loves cake.”  And trust me we love some cake.  With this mad love of SharePoint comes great collaboration and with this great collaboration comes tons of binary files stored in a database.  What does this mean to the DBA? SharePoint now consists of <a href="http://sqlserverpedia.com/wiki/Very_Large_Databases_%28VLDBs%29">VLDB’s</a>. </p>
<h3>Hmm… How do we move the VLDB’s across the USA and keep them in sync?</h3>
<p>With the built in features of Log Shipping, database Mirroring, Transactional Replication with SQL Server I knew it was possible to migrate the databases and keep them in-sync.   At the time I wasn’t exactly sure of the best way to do this so I used the bat phone.</p>
<p>While some people love SharePoint I love Twitter. Twitter allows me to communicate with several great DBA’s.  For example, I used <a href="http://www.brentozar.com/archive/2009/12/i-need-sqlhelp/">#sqlhelp</a> which is the equivalent of getting Batman on the bat phone.  This time it was Brent Ozar ( <a href="http://twitter.com/brento">Twitter</a> | <a href="http://www.brentozar.com">Blog</a>) who confirmed my gut feeling that Log Shipping was the way to go.</p>
<h3>So…. How do you do it?</h3>
<p>The complete process I used is documented at <a href="http://www.mssqltips.com/tip.asp?tip=2073">mssqltips #2073</a>.  This tip walks you though the process of 22 steps to get the job done.  I hope this tip helps out other DBA’s that need to migrate VLDB’s from one location to another location without using third party tools.</p>
<p>If you have any comments or suggestions please forward them along.</p>
]]></content:encoded>
			<wfw:commentRss>http://johnsterrett.com/2010/08/03/moving-sharepoint-to-the-data-center/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using Profiler to trace database calls from third-party applications</title>
		<link>http://johnsterrett.com/2010/06/16/using-profiler-to-trace-database-calls-from-third-party-applications/</link>
		<comments>http://johnsterrett.com/2010/06/16/using-profiler-to-trace-database-calls-from-third-party-applications/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 15:00:55 +0000</pubDate>
		<dc:creator>johnsterrett</dc:creator>
				<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://johnsterrett.com/?p=234</guid>
		<description><![CDATA[Today using profiler to trace database calls from third-party applications was published on www.mssqltips.com.  Hopefully, this tip will help some people understand why profiler is bacon.  In this example I trace two queries with Management Studio.  Speaking of Management Studio, have you ever wondered what queries are executed by your favorite features of Management Studio?  You can follow [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjohnsterrett.com%2F2010%2F06%2F16%2Fusing-profiler-to-trace-database-calls-from-third-party-applications%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjohnsterrett.com%2F2010%2F06%2F16%2Fusing-profiler-to-trace-database-calls-from-third-party-applications%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Today <a href="http://www.mssqltips.com/tip.asp?tip=2040">using profiler to trace database calls from third-party applications </a>was published on <a href="http://www.mssqltips.com">www.mssqltips.com</a>.  Hopefully, this tip will help some people understand why profiler is bacon.  In this example I trace two queries with Management Studio.  Speaking of Management Studio, have you ever wondered what queries are executed by your favorite features of Management Studio?  You can follow the steps in this tip to do that too.</p>
<p>This is my fist tip published at <a href="http://www.mssqltips.com">www.mssqltips.com</a>.  I look forward to publishing tips on a monthly basis.</p>
]]></content:encoded>
			<wfw:commentRss>http://johnsterrett.com/2010/06/16/using-profiler-to-trace-database-calls-from-third-party-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cutover 30+ GB databases in 60 seconds with SQL Server 2005/2008</title>
		<link>http://johnsterrett.com/2010/02/23/cutover-30-gb-databases-in-60-seconds-with-sql-server-20052008/</link>
		<comments>http://johnsterrett.com/2010/02/23/cutover-30-gb-databases-in-60-seconds-with-sql-server-20052008/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 12:58:51 +0000</pubDate>
		<dc:creator>johnsterrett</dc:creator>
				<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQLServerPedia Syndication]]></category>
		<category><![CDATA[High Availability]]></category>
		<category><![CDATA[Mirroring]]></category>
		<category><![CDATA[Restore]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://johnsterrett.com/?p=151</guid>
		<description><![CDATA[You kid brother just messed up a database migration.  You now have sixty seconds to migrate a 30 GB database or you kid brother is… Okay I gave it a shot If you are familiar with moving databases across servers most likely you are using one of the following methods.  Today I am going to [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjohnsterrett.com%2F2010%2F02%2F23%2Fcutover-30-gb-databases-in-60-seconds-with-sql-server-20052008%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjohnsterrett.com%2F2010%2F02%2F23%2Fcutover-30-gb-databases-in-60-seconds-with-sql-server-20052008%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<div><img style="display: inline; margin-left: 2px; margin-right: 2px" src="http://www.currentfilm.com/images3/60secondsdvd.jpg" alt="" width="133" height="183" align="left" />You kid brother just messed up a database migration.  You now have sixty seconds to migrate a 30 GB database or you kid brother is…</p>
<p>Okay I gave it a shot <img src='http://johnsterrett.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>If you are familiar with moving databases across servers most likely you are using one of the following methods.  Today I am going to write about what goes on during these methods with a focus on speed and provide another option that might work for you. <BR></p>
<ul>
<li>Detach/Attach</li>
<li>Copy Database Wizard</li>
<li>Backup/Restore</li>
<li>3rd Party Tools</li>
</ul>
<h2>Detach/Attach</h2>
<p>The detach/attach method allows you to detach and reattach databases. Therefore, in order to move a database from one server to another you have to detach the database, physically move the data and log files to the new server and then attach the database.  <strong>An unforeseen bottleneck with this strategy might be network latency. </strong>While this method is very straight forward and simple how long can the database be offline while you are moving the database files (mdf, ndf, ldf) during the detach/attach process?</p>
<h2>Copy Database Wizard</h2>
<p>The copy database wizard is a tool that leverages SQL Server Integration Services (SSIS) to copy a database from one server to another.  The account that the package uses at runtime has to have <em>sysadmin</em> role on both the source and destination instances.  You have two options during the copy process.  The first method is detach/attach see the paragraph above for feedback on using detach/attach.  The second method includes using SMO to script database objects.  This method keeps the source database online during the copy but is much slower than the detach/attach.  Therefore, I have no feedback on this method.  Have you used it? If so please add your comments.</p>
<h2>Backup/Restore</h2>
<p>Assuming you are using the Full recovery mode for your database the backup restore method for moving a database involves taking a full backup and a transactional log backup where you backup the tail of the log, and leave the database in restoring state.  This will take the source database offline keep the data in sync.  With restore time being a factor you could restore the full backup and do incremental transaction logs up to the point of cutting over assuming assuming no full backups occurred on your database while you started applying transactional backups.</p>
<h2>And the winner is…</h2>
<p>Drum roll please……..  And the winner is <strong>Database Mirroring in High Availability Mode</strong> as it can allow you to <span style="text-decoration: line-through;">cutover</span> failover to migrate huge databases in less than sixty seconds.  Okay I might be cheating, it will take much more than sixty seconds to configure. <strong>The important fact is that it will seam like it only took seconds to the end users.</strong> If your application uses .NET 2.0+ framework and you configure client side redirect the end users might not experience an outage at all.</p>
<p>To setup database mirroring it is highly recommended to make sure the principal and mirror database engine services are using service accounts, they also need access the the ports used by SQL endpoints, and more&#8230;.  Check out the MSDN site for a great <a href="http://msdn.microsoft.com/en-us/library/cc917680.aspx">guide for Database Mirroring</a>.  </div>
]]></content:encoded>
			<wfw:commentRss>http://johnsterrett.com/2010/02/23/cutover-30-gb-databases-in-60-seconds-with-sql-server-20052008/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Disk usage monitoring with Data Collector</title>
		<link>http://johnsterrett.com/2009/12/08/disk-usage-monitoring-with-data-collector/</link>
		<comments>http://johnsterrett.com/2009/12/08/disk-usage-monitoring-with-data-collector/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 22:43:54 +0000</pubDate>
		<dc:creator>johnsterrett</dc:creator>
				<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQLServerPedia Syndication]]></category>
		<category><![CDATA[data collector]]></category>
		<category><![CDATA[Monitoring]]></category>

		<guid isPermaLink="false">http://johnsterrett.com/2009/12/08/disk-usage-monitoring-with-data-collector/</guid>
		<description><![CDATA[Today, I am jumping into Adam Machanic T-SQL Tuesday challenge with the following post. Recently, I created a build request to have a new server to move SQL Server databases.  I put together an estimate for the space needed for data, logs and backups and included this information in the build document.  This request was [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjohnsterrett.com%2F2009%2F12%2F08%2Fdisk-usage-monitoring-with-data-collector%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjohnsterrett.com%2F2009%2F12%2F08%2Fdisk-usage-monitoring-with-data-collector%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Today, I am jumping into <a href="http://sqlblog.com/blogs/adam_machanic">Adam Machanic</a> <a href="http://sqlblog.com/blogs/adam_machanic/archive/2009/11/30/invitation-to-participate-in-t-sql-tuesday-001-date-time-tricks.aspx">T-SQL Tuesday challenge</a> with the following post.</p>
<p>Recently, I created a build request to have a new server to move SQL Server databases.  I put together an estimate for the space needed for data, logs and backups and included this information in the build document.  This request was put in the queue and all was well.  Once this request popped to the top of the queue I reviewed the size of database files using Idera’s Space Analyzer and noticed unexpected data growth in a few of the data files.  Thankfully, the data collector and Management Data Warehouse (MDW) was enabled which helped us track the unexpected data growth.</p>
<h2>Introduction</h2>
<p>SQL Server 2008 introduces the data collector and the management data warehouse (MDW) into SQL Server Management Studio (SSMS). The Management Data Warehouse exists by leveraging the data collector and a MDW database and custom reports. This allows administrators and developers the opportunity to do some proactive monitoring. If you are familiar with the <a href="http://www.sql-server-performance.com/articles/per/bm_performance_dashboard_2005_p1.aspx">Performance Dashboard</a> then you will be impressed with the new Management Data Warehouse.</p>
<h2>How does the data collector help you?</h2>
<p>Out of the box, the data collector provides you with the tools to monitor <strong><em>disk usage, server activity and query statistics</em></strong>.  Therefore, when you are asked the following questions.  How much space do we need for database xyz? Why did database xyz grow from size 123 to size 456? you can use the data collector report to help answer these questions.  For example, below is a screen shot of some sample databases.</p>
<p><a href="http://johnsterrett.com/img/DiskusagemonitoringwithDataCollector_F572/image.png"><img style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" title="image" src="http://johnsterrett.com/img/DiskusagemonitoringwithDataCollector_F572/image_thumb.png" border="0" alt="image" width="244" height="114" /></a></p>
<p>You can see that the third, forth and fifth databases had their current size changed.  I want to focus on this fact because it doesn’t represent the data inside the database files.  This means <strong>the actual data files (mdf, ndf, ldf) are growing which can cause disk fragmentation.</strong> You want to avoid this when possible.  Ideally, you want your database graph to be a straight line like the sixth database.  Next we will click on the graph for the fourth database and drill deeper to the analysis.</p>
<p><a href="http://johnsterrett.com/img/DiskusagemonitoringwithDataCollector_F572/image_3.png"><img style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" title="image" src="http://johnsterrett.com/img/DiskusagemonitoringwithDataCollector_F572/image_thumb_3.png" border="0" alt="image" width="244" height="110" /></a></p>
<p><a href="http://johnsterrett.com/img/DiskusagemonitoringwithDataCollector_F572/image_4.png"><img style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" title="image" src="http://johnsterrett.com/img/DiskusagemonitoringwithDataCollector_F572/image_thumb_4.png" border="0" alt="image" width="244" height="29" /></a></p>
<p>Looking at the two image above you can see that the data size multiplied during a six hour between noon and 6pm on November 30th.  We were then able to use this information to determine the cause for the unexpected growth of data.</p>
<h2>Conclusion</h2>
<p>I think this is a great tool to troubleshoot unexpected data growth.  I look forward to using this tool as part of the process to estimate future database growth.</p>
]]></content:encoded>
			<wfw:commentRss>http://johnsterrett.com/2009/12/08/disk-usage-monitoring-with-data-collector/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Data Warehouse: Facts and Measures</title>
		<link>http://johnsterrett.com/2009/11/05/data-warehouse-facts-and-measures/</link>
		<comments>http://johnsterrett.com/2009/11/05/data-warehouse-facts-and-measures/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 04:41:51 +0000</pubDate>
		<dc:creator>johnsterrett</dc:creator>
				<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQLServerPedia Syndication]]></category>
		<category><![CDATA[Data Warehouse]]></category>
		<category><![CDATA[SSAS]]></category>

		<guid isPermaLink="false">http://johnsterrett.com/2009/11/05/data-warehouse-facts-and-measures/</guid>
		<description><![CDATA[A few days ago I wrote a post that gave an introduction to dimensions.  Today, we are going to continue covering the basic concepts included in dimensional modeling by covering an introduction to fact tables and measures.  These posts are all part of the introduction to building a data warehouse with sql server series. What [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjohnsterrett.com%2F2009%2F11%2F05%2Fdata-warehouse-facts-and-measures%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjohnsterrett.com%2F2009%2F11%2F05%2Fdata-warehouse-facts-and-measures%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>A few days ago I wrote a post that gave an <a href="http://johnsterrett.com/2009/11/01/introduction-to-dimensions/">introduction to dimensions</a>.  Today, we are going to continue covering the basic concepts included in dimensional modeling by covering an introduction to fact tables and measures.  These posts are all part of the <a href="http://johnsterrett.com/2009/09/29/building-a-data-warehouse-with-sql-server/">introduction to building a data warehouse with sql server</a> series.</p>
<h3>What is a Fact Table?</h3>
<p>A fact table is a table that joins dimension tables with measures.  For example, Lets say you wanted to know the time worked by employees, by location, by project and by task.  If you had a dimension for employees, location, project and task you would create a composite primary key using these foreign keys and add an additional column for the time worked measure. (more on measures in a little bit)</p>
<p>Keep in mind that fact tables are huge unlike dimension tables.  Fact tables are usually built to contain a hundred thousand records on the low side up to billions of records on the high side.  Therefore, these tables must be normalized to be efficient.</p>
<p>A fact table is normalized when it consists of the following two things:</p>
<ol>
<li>
<ol>
<li>A composite primary key using the foreign keys to the dimension tables.</li>
<li>Measure(s) used for numerical analysis.</li>
</ol>
</li>
</ol>
<h3>What is a measure?</h3>
<p>A measure is normally an additive numerical value that represents a business metric.  You are also not limited to a single measure.  You can have multiple measures within a fact table.  For example, if your fact table is used to track purchases internationally you might have measures for each type of currency.  If you are building a fact table for the retail industry you might also have the following measures cost, list price, average sale price.</p>
<p>Next we will conclude or session on dimensional modeling and start to build our first cube.</p>
]]></content:encoded>
			<wfw:commentRss>http://johnsterrett.com/2009/11/05/data-warehouse-facts-and-measures/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Introduction to Dimensions</title>
		<link>http://johnsterrett.com/2009/11/01/introduction-to-dimensions/</link>
		<comments>http://johnsterrett.com/2009/11/01/introduction-to-dimensions/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 15:00:18 +0000</pubDate>
		<dc:creator>johnsterrett</dc:creator>
				<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQLServerPedia Syndication]]></category>
		<category><![CDATA[Data Warehouse]]></category>
		<category><![CDATA[SSAS]]></category>

		<guid isPermaLink="false">http://johnsterrett.com/?p=89</guid>
		<description><![CDATA[Today, we are going to quickly cover one of the basic concepts included in dimensional modeling.  We are going over the basics of dimensions, attributes and hierarchies.  We will review how they are related and how they work within Data Warehouses.  If you are looking for an introduction to building a data warehouse click here. [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjohnsterrett.com%2F2009%2F11%2F01%2Fintroduction-to-dimensions%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjohnsterrett.com%2F2009%2F11%2F01%2Fintroduction-to-dimensions%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Today, we are going to quickly cover one of the basic concepts included in dimensional modeling.  We are going over the basics of dimensions, attributes and hierarchies.  We will review how they are related and how they work within Data Warehouses.  If you are looking for an introduction to building a data warehouse <a href="http://johnsterrett.com/2009/09/29/building-a-data-warehouse-with-sql-server/">click here</a>.</p>
<h3>What is a Dimension Table?</h3>
<p>A dimension table provides the description behind the analytic numbers.  It describes the who, what, when, where and why behind the facts. Dimensions are normally broken down into groups (tables) and they contain several attributes (columns).   Unlike a fact table the dimension table is not normalized.  Generally, dimension tables have many columns but a limited amount of rows. <strong>Dimension tables normally provide two purposes in a data warehouse, it can be used to <span style="text-decoration: underline;">filter queries</span> and to <span style="text-decoration: underline;">select data</span>.</strong></p>
<p>Several data warehouses include the following dimension tables products, employees, customers, time, and location.  Lets say your business requirement is to provide an  time tracking data warehouse.  You would to want to implement a employee dimension table that included at least the following attributes (columns) first name, last name, status, start date, hire date, end date, department name title, salary etc….   we could actually go on and on and this is okay as long as the attributes support your business requirements.</p>
<h3><a href="http://johnsterrett.com/img/DimensionsandHierarchies_B1A5/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" src="http://johnsterrett.com/img/DimensionsandHierarchies_B1A5/image_thumb.png" border="0" alt="image" width="244" height="135" /></a> <a href="http://johnsterrett.com/img/DimensionsandHierarchies_B1A5/image_3.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" src="http://johnsterrett.com/img/DimensionsandHierarchies_B1A5/image_thumb_3.png" border="0" alt="image" width="239" height="142" /></a></h3>
<h3>What are dimension hierarchies?</h3>
<p>Dimension hierarchies provide a way to define a relationship between multiple attributes within a dimension. They are commonly defined as a structure to provide drill up and drill down capabilities.  You can have multiple hierarchies within a dimension. For example, in a time dimension you might want to have two separate hierarchies, one for fiscal year and another for calendar year.  These two dimension could contain the following attributes year, quarter, month, day.</p>
<p align="center"><a href="http://johnsterrett.com/img/DimensionsandHierarchies_B1A5/image_4.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" src="http://johnsterrett.com/img/DimensionsandHierarchies_B1A5/image_thumb_4.png" border="0" alt="image" width="151" height="160" /></a></p>
<h3>Best Practices for designing a Dimension table</h3>
<ul>
<li>Use a unique identifier integer column that is auto incremental as your primary key.  This is commonly known as a surrogate key.</li>
<li>Use the source’s primary key as an alternating key.</li>
<li>Any additional attributes (columns) that describe the business entity</li>
</ul>
<h3>Slowly Changing Dimensions</h3>
<p>Now that we know how to build a dimension we need to consider how the data is stored.  Yes, occasionally the attribute data changes.  For example, lets pretend you are a die hard Pirates fan and built a Data Warehouse to do analysis on your favorite players.  How would you handle promotions like <a href="http://en.wikipedia.org/wiki/Andrew_McCutchen">Andrew McCutchen</a> getting called up from AAA Indianapolis to the Pirates?</p>
<p>The following are options to handle slowly changing dimensions:</p>
<ol>
<li>Do nothing (type 0).  This approach is highly not recommended.  This cannot guarantee history preservation and includes the least control over managing changed attributes.</li>
<li>Overwrite old data with new data (type 1)<br />
This completely overwrites the previous attribute value.  This could be ideal if you had a spelling error or the historical value of this column is not crucial. This is the easiest method to implement but it can be hard to manage.</li>
<li>Create multiple records with different key values (type 2)<br />
This provides you with the ability to have an unlimited amount of history.  It is usually implemented by adding a start and end date column.  If you have to make changes to past records this could require you to also update fact records.</li>
<li>Create a new column for previous values (type 3)<br />
This allows only a fixed amount of history to be retained.  If you create two extra columns for the team attribute you can only store three team values (the current value and last two previous values)</li>
</ol>
<p>I hope you enjoyed this post.  Next we will cover an<a href="http://johnsterrett.com/2009/11/05/data-warehouse-facts-and-measures/"> introduction to facts and measures</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://johnsterrett.com/2009/11/01/introduction-to-dimensions/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Reporting Service Statistics</title>
		<link>http://johnsterrett.com/2009/10/20/reporting-service-statistics/</link>
		<comments>http://johnsterrett.com/2009/10/20/reporting-service-statistics/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 12:54:56 +0000</pubDate>
		<dc:creator>johnsterrett</dc:creator>
				<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQLServerPedia Syndication]]></category>
		<category><![CDATA[SSRS analytics]]></category>

		<guid isPermaLink="false">http://www.johnsterrett.com/?p=84</guid>
		<description><![CDATA[Question: How do I obtain statistics for the utilization of SSRS reports? Solution: With a little research I found a great sample application on codeplex that provides statistics for SSRS.  The Server Management Sample Reports are available for both SQL Server 2005 &#38; 2008. The following solution provides answers to the following questions.  What are [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjohnsterrett.com%2F2009%2F10%2F20%2Freporting-service-statistics%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjohnsterrett.com%2F2009%2F10%2F20%2Freporting-service-statistics%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p><strong>Question:<br />
</strong>How do I obtain statistics for the utilization of SSRS reports?</p>
<p><strong>Solution:</strong></p>
<p>With a little research I found a great sample application on <a href="http://www.codeplex.com/">codeplex</a> that provides statistics for SSRS.  The <a href="http://msftrsprodsamples.codeplex.com/wikipage?title=SS2008!Server%20Management%20Sample%20Reports&amp;ProjectName=msftrsprodsamples">Server Management Sample Reports</a> are available for both SQL Server 2005 &amp; 2008.</p>
<p>The following solution provides answers to the following questions.  What are the top 10 most executed reports? What reports have the longest average execution time?  Who is accessing the reports?</p>
<p><a href="http://johnsterrett.com/img/ReportingServicesStatistics_FA91/SSRSAnalytics.jpg"><img style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" title="SSRS Analytics" src="http://johnsterrett.com/img/ReportingServicesStatistics_FA91/SSRSAnalytics_thumb.jpg" border="0" alt="SSRS Analytics" width="244" height="175" /></a></p>
<p>To implement this solution all you have to is download the <a href="http://msftrsprodsamples.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=34047">sample solution</a> and follow the installation guide.  If you have any questions <a href="http://www.johnsterrett.com/2009/10/20/reporting-service-statisticsreporting-service-statistics/">post them here</a> and I will do my best to help you out.</p>
]]></content:encoded>
			<wfw:commentRss>http://johnsterrett.com/2009/10/20/reporting-service-statistics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get index fragmentation statistics</title>
		<link>http://johnsterrett.com/2009/09/30/get-index-fragmentation-statistics/</link>
		<comments>http://johnsterrett.com/2009/09/30/get-index-fragmentation-statistics/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 15:31:51 +0000</pubDate>
		<dc:creator>johnsterrett</dc:creator>
				<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQLServerPedia Syndication]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[DMV]]></category>
		<category><![CDATA[indexes]]></category>

		<guid isPermaLink="false">http://www.johnsterrett.com/?p=74</guid>
		<description><![CDATA[I recently attended a Pittsburgh SQL Server user group meeting where Brent Ozar gave a presentation on the silent performance killer.  This motivated me to create a stored procedure that could leverage the DMVs in SQL 2005/2008 to gather index fragmentation statistics for all databases on a given server. Goal The goal is very simple.  [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjohnsterrett.com%2F2009%2F09%2F30%2Fget-index-fragmentation-statistics%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjohnsterrett.com%2F2009%2F09%2F30%2Fget-index-fragmentation-statistics%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>I recently attended a Pittsburgh SQL Server user group meeting where <a href="http://www.brentozar.com/">Brent Ozar</a> gave a presentation on the <a href="http://www.brentozar.com/archive/2009/02/index-fragmentation-findings-part-1-the-basics/">silent performance killer</a>.  This motivated me to create a stored procedure that could leverage the DMVs in SQL 2005/2008 to gather index fragmentation statistics for all databases on a given server.</p>
<h2>Goal</h2>
<p>The goal is very simple.  Build a query that could be scheduled to grab statistics that are helpful towards determining if an index needs to be defragged or reorganized.  I would like to throw these results into a table so I could analyze them at a later date.  I would also like to monitor the fill factor and padding to determine if I need to make changes and to analyze if the changes are really helpful.</p>
<h2>Download Scripts</h2>
<p>The following script uses the following DMV’s <a href="http://msdn.microsoft.com/en-us/library/ms188917.aspx">sys.dm_db_index_physical_stats</a>, <a href="http://msdn.microsoft.com/en-us/library/ms190324.aspx">sys.objects</a> and <a href="http://msdn.microsoft.com/en-us/library/ms173760.aspx">sys.indexes</a> and this script is provided as is.</p>
<div id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:67868802-4c0a-4d46-8baf-3a5ecca4eca9" class="wlWriterEditableSmartContent" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px">
<p><a href="http://johnsterrett.com/img/Getindexfragmentationstatistics_B1B1/GetStatsForIndexesStoredProcedure.sql" target="_blank"></a></div>
<div id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:02649ce7-775f-4a18-9475-092edfca84fc" class="wlWriterEditableSmartContent" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px">
<p>To download the script <a href="http://johnsterrett.com/img/Getindexfragmentationstatistics_B1B1/GetStatsForIndexesStoredProcedure_3.sql" target="_blank">click here</a></div>
<div id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:c9feced2-11f3-426e-8854-f3051c9eb67b" class="wlWriterEditableSmartContent" style="padding-right: 0px; display: inline; padding-left: 0px; float: left; padding-bottom: 0px; margin: 0px; padding-top: 0px">
<p>To download the create table script for the table used <a href="http://johnsterrett.com/img/Getindexfragmentationstatistics_B1B1/SQLTableIndexStats.sql" target="_blank">click here</a></div>
<p><BR/></p>
<h2>Table Definition</h2>
<p>The following is an explanation of the columns.  The following descriptions come from MSDN.</p>
<table border="3" cellspacing="0" cellpadding="2" width="508">
<tbody>
<tr>
<td width="166" valign="top">
<p align="center"><strong>Column Name</strong></p>
</td>
<td width="336" valign="top">
<p align="center"><strong>Description</strong></p>
</td>
</tr>
<tr>
<td width="167" valign="top">databaseName</td>
<td width="336" valign="top"><strong></strong></p>
<p>Name of database, unique within an instance of SQL Server.</td>
</tr>
<tr>
<td width="167" valign="top">objectName</td>
<td width="336" valign="top">Object name.</td>
</tr>
<tr>
<td width="167" valign="top">indexName</td>
<td width="336" valign="top">Name of the index. <strong>name</strong> is unique only within the object.</p>
<p>NULL = Heap</td>
</tr>
<tr>
<td width="167" valign="top">partitionNumber</td>
<td width="336" valign="top">1-based partition number within the owning object; a table, view, or index.</p>
<p>1 = Nonpartitioned index or heap.</td>
</tr>
<tr>
<td width="167" valign="top">fragmentation</td>
<td width="336" valign="top">Logical fragmentation for indexes, or extent fragmentation for heaps in the IN_ROW_DATA allocation unit.</p>
<p>The value is measured as a percentage and takes into account multiple files. For definitions of logical and extent fragmentation, see Remarks.</p>
<p>0 for LOB_DATA and ROW_OVERFLOW_DATA allocation units.</p>
<p>NULL for heaps when <em>mode</em> = SAMPLED.</td>
</tr>
<tr>
<td width="167" valign="top">fill_factor</td>
<td width="336" valign="top">&gt; 0 = FILLFACTOR percentage used when the index was created or rebuilt.</p>
<p>0 = Default value</td>
</tr>
<tr>
<td width="167" valign="top">is_padded</td>
<td width="336" valign="top">1 = PADINDEX is ON.</p>
<p>0 = PADINDEX is OFF.</td>
</tr>
<tr>
<td width="167" valign="top">type_desc</td>
<td width="336" valign="top">Description of index type:</p>
<p>HEAP<br />
CLUSTERED<br />
NONCLUSTERED<br />
XML<br />
SPATIAL</td>
</tr>
<tr>
<td width="167" valign="top">page_count</td>
<td width="336" valign="top">Total number of index or data pages.</p>
<p>For an index, the total number of index pages in the current level of the b-tree in the IN_ROW_DATA allocation unit.</p>
<p>For a heap, the total number of data pages in the IN_ROW_DATA allocation unit.</p>
<p>For LOB_DATA or ROW_OVERFLOW_DATA allocation units, total number of pages in the allocation unit.</td>
</tr>
<tr>
<td width="167" valign="top">date</td>
<td width="336" valign="top">this is the current date GETDATE()</td>
</tr>
</tbody>
</table>
<h2>Script</h2>
<div class="csharpcode">
<pre><span class="lnum">   1:  </span><span class="kwrd">ALTER</span> <span class="kwrd">PROCEDURE</span> [dbo].[GetStatsForIndexes]</pre>
<pre><span class="lnum">   2:  </span>    @PageCount <span class="kwrd">INT</span> = 100</pre>
<pre><span class="lnum">   3:  </span></pre>
<pre><span class="lnum">   4:  </span><span class="kwrd">AS</span></pre>
<pre><span class="lnum">   5:  </span><span class="kwrd">BEGIN</span></pre>
<pre><span class="lnum">   6:  </span>    <span class="rem">-- SET NOCOUNT ON added to prevent extra result sets from</span></pre>
<pre><span class="lnum">   7:  </span>    <span class="rem">-- interfering with SELECT statements.</span></pre>
<pre><span class="lnum">   8:  </span>    <span class="kwrd">SET</span> NOCOUNT <span class="kwrd">ON</span>;</pre>
<pre><span class="lnum">   9:  </span></pre>
<pre><span class="lnum">  10:  </span>    <span class="rem">-- Declare varables</span></pre>
<pre><span class="lnum">  11:  </span>    <span class="kwrd">DECLARE</span> @dbID <span class="kwrd">INT</span>, @dbName <span class="kwrd">VARCHAR</span>(128), @<span class="kwrd">SQL</span> NVARCHAR(<span class="kwrd">MAX</span>)</pre>
<pre><span class="lnum">  12:  </span></pre>
<pre><span class="lnum">  13:  </span>    <span class="rem">-- Create a temp table to store all active databases</span></pre>
<pre><span class="lnum">  14:  </span>    <span class="kwrd">CREATE</span> <span class="kwrd">TABLE</span> #databaseList</pre>
<pre><span class="lnum">  15:  </span>    (</pre>
<pre><span class="lnum">  16:  </span>          databaseID        <span class="kwrd">INT</span></pre>
<pre><span class="lnum">  17:  </span>        , databaseName      <span class="kwrd">VARCHAR</span>(128)</pre>
<pre><span class="lnum">  18:  </span>    );</pre>
<pre><span class="lnum">  19:  </span></pre>
<pre><span class="lnum">  20:  </span>    <span class="rem">-- we only want non-system databases who are currenlty online</span></pre>
<pre><span class="lnum">  21:  </span>    INSERT <span class="kwrd">INTO</span> #databaseList (databaseID, databaseName)</pre>
<pre><span class="lnum">  22:  </span>    <span class="kwrd">SELECT</span> d.database_id, d.name <span class="kwrd">FROM</span> sys.databases d <span class="kwrd">where</span> d.[<span class="kwrd">state</span>] = 0 <span class="kwrd">and</span> d.database_id &gt; 4</pre>
<pre><span class="lnum">  23:  </span></pre>
<pre><span class="lnum">  24:  </span></pre>
<pre><span class="lnum">  25:  </span>    <span class="rem">-- Loop through all databases </span></pre>
<pre><span class="lnum">  26:  </span>       <span class="kwrd">WHILE</span> (<span class="kwrd">SELECT</span> <span class="kwrd">COUNT</span>(*) <span class="kwrd">FROM</span> #databaseList) &gt; 0  <span class="kwrd">BEGIN</span></pre>
<pre><span class="lnum">  27:  </span></pre>
<pre><span class="lnum">  28:  </span>           <span class="rem">-- get a database id</span></pre>
<pre><span class="lnum">  29:  </span>        <span class="kwrd">SELECT</span> <span class="kwrd">TOP</span> 1 @dbID = databaseID, @dbName = databaseName</pre>
<pre><span class="lnum">  30:  </span>        <span class="kwrd">FROM</span> #databaseList;</pre>
<pre><span class="lnum">  31:  </span></pre>
<pre><span class="lnum">  32:  </span>            <span class="kwrd">SET</span> @<span class="kwrd">SQL</span> = <span class="str">'INSERT INTO DBA_Tools.dbo.IDX_FRAG (databaseName, ObjectName, indexName, partitionNumber, fragmentation, fill_factor, is_padded, type_desc, page_count, [date])</span></pre>
<pre><span class="lnum">  33:  </span>                SELECT</pre>
<pre><span class="lnum">  34:  </span>                  db.name AS databaseName</pre>
<pre><span class="lnum">  35:  </span>                , obj.name AS ObjectName</pre>
<pre><span class="lnum">  36:  </span>                , idx.name AS indexName</pre>
<pre><span class="lnum">  37:  </span>                , ps.partition_number AS partitionNumber</pre>
<pre><span class="lnum">  38:  </span>                , ps.avg_fragmentation_in_percent AS fragmentation</pre>
<pre><span class="lnum">  39:  </span>                ,idx.fill_factor</pre>
<pre><span class="lnum">  40:  </span>                ,idx.is_padded</pre>
<pre><span class="lnum">  41:  </span>                ,idx.type_desc</pre>
<pre><span class="lnum">  42:  </span>                , ps.page_count</pre>
<pre><span class="lnum">  43:  </span>                , GETDATE() as [date]</pre>
<pre><span class="lnum">  44:  </span>            FROM sys.databases db</pre>
<pre><span class="lnum">  45:  </span>              INNER JOIN sys.dm_db_index_physical_stats ('+<span class="kwrd">CAST</span>(@dbID <span class="kwrd">AS</span> <span class="kwrd">VARCHAR</span>(10))+<span class="str">', NULL, NULL , NULL, N'</span><span class="str">'Limited'</span><span class="str">') ps</span></pre>
<pre><span class="lnum">  46:  </span>                  ON db.database_id = ps.database_id</pre>
<pre><span class="lnum">  47:  </span>              INNER JOIN '+ @dbName+<span class="str">'.sys.objects obj ON obj.object_id = ps.object_id</span></pre>
<pre><span class="lnum">  48:  </span>              INNER JOIN '+ @dbName+<span class="str">'.sys.indexes idx ON idx.index_id = ps.index_id AND idx.object_id = ps.object_id</span></pre>
<pre><span class="lnum">  49:  </span>            WHERE ps.index_id &gt; 0</pre>
<pre><span class="lnum">  50:  </span>               AND ps.page_count &gt; 100</pre>
<pre><span class="lnum">  51:  </span>            ORDER BY page_count desc</pre>
<pre><span class="lnum">  52:  </span>            OPTION (MaxDop 1);'</pre>
<pre><span class="lnum">  53:  </span></pre>
<pre><span class="lnum">  54:  </span>        <span class="kwrd">EXECUTE</span> sp_executesql @<span class="kwrd">SQL</span></pre>
<pre><span class="lnum">  55:  </span>        <span class="rem">-- remove the database from the databases table</span></pre>
<pre><span class="lnum">  56:  </span>        <span class="kwrd">DELETE</span> <span class="kwrd">FROM</span> #databaseList <span class="kwrd">WHERE</span> databaseID = @dbID</pre>
<pre><span class="lnum">  57:  </span></pre>
<pre><span class="lnum">  58:  </span>        <span class="rem">-- get the next database in the databases table</span></pre>
<pre><span class="lnum">  59:  </span>        <span class="kwrd">SELECT</span> <span class="kwrd">TOP</span> 1 @dbID = databaseID, @dbName = databaseName</pre>
<pre><span class="lnum">  60:  </span>        <span class="kwrd">FROM</span> #databaseList;</pre>
<pre><span class="lnum">  61:  </span></pre>
<pre><span class="lnum">  62:  </span>    <span class="kwrd">END</span></pre>
<pre><span class="lnum">  63:  </span>    <span class="rem">-- temp table is no longer needed, so we will kill it.</span></pre>
<pre><span class="lnum">  64:  </span>    <span class="kwrd">DROP</span> <span class="kwrd">TABLE</span> #databaseList;</pre>
<pre><span class="lnum">  65:  </span><span class="kwrd">END</span></pre>
</div>
<p><!--.csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --> <!--.csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
]]></content:encoded>
			<wfw:commentRss>http://johnsterrett.com/2009/09/30/get-index-fragmentation-statistics/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Can SQLSaturday happen in Wheeling, WV?</title>
		<link>http://johnsterrett.com/2009/08/16/can-sqlsaturday-work-in-wheeling-wv/</link>
		<comments>http://johnsterrett.com/2009/08/16/can-sqlsaturday-work-in-wheeling-wv/#comments</comments>
		<pubDate>Mon, 17 Aug 2009 01:18:37 +0000</pubDate>
		<dc:creator>johnsterrett</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQLSaturday]]></category>
		<category><![CDATA[Wheeling]]></category>

		<guid isPermaLink="false">http://www.johnsterrett.com/2009/08/16/can-sqlsaturday-work-in-wheeling-wv/</guid>
		<description><![CDATA[I noticed a great event that is occurring down south.  Its called SQLSaturday and one of my short term goals is to see if it’s possible to bring this great event to Wheeling, WV.  What is SQLSaturday? SQLSaturday is a platform for free one day training events for SQL Server professionals. This event focuses on [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjohnsterrett.com%2F2009%2F08%2F16%2Fcan-sqlsaturday-work-in-wheeling-wv%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjohnsterrett.com%2F2009%2F08%2F16%2Fcan-sqlsaturday-work-in-wheeling-wv%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>I noticed a great event that is occurring down south.  Its called <a href="http://sqlsaturday.com/default.aspx" target="_blank">SQLSaturday</a> and one of my short term goals is to see if it’s possible to bring this great event to Wheeling, WV. </p>
<h3>What is SQLSaturday?</h3>
<p><a href="http://sqlsaturday.com/default.aspx" target="_blank">SQLSaturday</a> is a platform for <strong><span style="text-decoration: underline;">free one day training events for SQL Server professionals</span></strong>. This event focuses on speakers, providing a good variety of topics, and making it all happen through the efforts of volunteers. Whether you&#8217;re attending one or thinking about hosting your own(this would be me), we think you&#8217;ll find it&#8217;s a great way to spend a Saturday.</p>
<h3>Initial Goals:</h3>
<ol>
<li>Bring technology professionals from Pittsburgh, Columbus and Morgantown to Wheeling.</li>
<li>Have 50 to100 attendees attend this initial event.</li>
<li>Provide great speakers to present topics about SQL Server and .NET</li>
<li>Utilize sponsors to <span style="text-decoration: underline;"><strong>make the event 100% free to all who attend.</strong></span></li>
<li>Provide the opportunity for IT Professionals to network with their peers.</li>
<li>Provide exposure for <a href="http://www.aitp.org">AITP</a> and the <a href="http://aitp-wheeling.org" target="_blank">Greater Wheeling Chapter of AITP</a> </li>
</ol>
<h3>Conclusion:</h3>
<p>Will this event happen?  I sure hope so, but  I am still planning.  I hope to have an answer soon.  If we do go live I am targeting early 2010.</p>
<p>I will post my future action items and the decisions I make soon.  I hope that this series of posts are helpful for people who are contemplating if they should start a similar event in their area.</p>
<p>If you have any comments, thoughts or suggestions please share them.</p>
]]></content:encoded>
			<wfw:commentRss>http://johnsterrett.com/2009/08/16/can-sqlsaturday-work-in-wheeling-wv/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
