<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1280552045292386283</id><updated>2012-01-10T01:36:57.754-05:00</updated><category term='DBCC CHECKDB'/><category term='DBA Tutorials'/><category term='MOSS 2007'/><category term='Deadlocking'/><category term='SQL 2008'/><category term='Free Tools'/><category term='Certification'/><category term='SQL CLR'/><category term='SQL 2005'/><category term='PASS Summit'/><category term='Blocking'/><category term='Security'/><category term='Best Practices'/><category term='TSQL'/><category term='SSMS'/><category term='Book Reviews'/><category term='Rants'/><category term='Upgrade'/><category term='General'/><category term='Connect Feedbacks'/><category term='MSDN Forums'/><category term='SQL Error Messages'/><category term='Database Audits'/><category term='Miscellaneous'/><category term='Virtualization'/><category term='Extended Events'/><category term='Query Processing'/><category term='SQL Saturdays'/><title type='text'>The Rambling DBA</title><subtitle type='html'>This blog has been moved to SQLBlog.com

http://sqlblog.com/blogs/jonathan_kehayias/</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default?start-index=101&amp;max-results=100'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>143</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-2608748449259227060</id><published>2009-09-14T12:41:00.001-04:00</published><updated>2009-09-14T12:41:45.917-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Miscellaneous'/><title type='text'>OT: Internet Explorer 8 Multiple Tabs = Multiple Processes</title><content type='html'>&lt;p&gt;This has nothing to do with SQL Server, but it was something that I noticed today and had to do a bit of research for.&amp;#160; I recently upgraded from IE6 and IE7 on my work machines to IE8 since my Windows 7 Laptop uses IE8 I kind of got used to having some of its features.&amp;#160; By my very nature I tend to over work the common computer by having to many screens open as I jump around from task to task, and problem to problem. At any given point in the day, it is common for my task bar to be scrolling and it is currently set to hold three rows of applications.&lt;/p&gt;  &lt;p&gt;I previously made use of FireFox to take advantage of the multiple tabs, but have been using IE8 for the same feature.&amp;#160; (Chrome users, yes I know about it, no I don't care to try it, so please save comments about switching to Chrome :-) )&amp;#160; Today I had once again overworked my desktop to the point that it was having trouble switching screens, and it was especially having trouble switching tabs in IE8.&amp;#160; Curious whether or not a machine inventory (automated asset tracking software) or virus scan had been kicked off mid-day, I opened task manager and found a screen full of iexplore.exe processes.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_CSUuS5p4wm0/Sq5yR--aw-I/AAAAAAAAAHE/Jb1kneRBHAg/s1600-h/image%5B2%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" border="0" alt="image" src="http://lh5.ggpht.com/_CSUuS5p4wm0/Sq5ySIKi-GI/AAAAAAAAAHI/-RqanjoW9VM/image_thumb.png?imgmax=800" width="244" height="238" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Turns out this is by design in IE8:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://blogs.msdn.com/ie/archive/2008/03/11/ie8-and-loosely-coupled-ie-lcie.aspx" href="http://blogs.msdn.com/ie/archive/2008/03/11/ie8-and-loosely-coupled-ie-lcie.aspx"&gt;http://blogs.msdn.com/ie/archive/2008/03/11/ie8-and-loosely-coupled-ie-lcie.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;I also happened on this blog:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://blogs.msdn.com/askie/archive/2009/03/09/opening-a-new-tab-may-launch-a-new-process-with-internet-explorer-8-0.aspx" href="http://blogs.msdn.com/askie/archive/2009/03/09/opening-a-new-tab-may-launch-a-new-process-with-internet-explorer-8-0.aspx"&gt;http://blogs.msdn.com/askie/archive/2009/03/09/opening-a-new-tab-may-launch-a-new-process-with-internet-explorer-8-0.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;that shows how you can loosely control the configuration of this.&amp;#160; I am not sure that this feature is actually a benefit to me.&amp;#160; I am certainly using more memory and as shown in my screen shot above CPU from this.&amp;#160; What is really bad is that IE 8 is listed as an Important Update in Windows Update Services.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-2608748449259227060?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/2608748449259227060/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2009/09/ot-internet-explorer-8-multiple-tabs.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2608748449259227060'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2608748449259227060'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2009/09/ot-internet-explorer-8-multiple-tabs.html' title='OT: Internet Explorer 8 Multiple Tabs = Multiple Processes'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_CSUuS5p4wm0/Sq5ySIKi-GI/AAAAAAAAAHI/-RqanjoW9VM/s72-c/image_thumb.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-6212689487420688500</id><published>2009-09-03T15:07:00.001-04:00</published><updated>2009-09-03T15:08:24.447-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='Virtualization'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='Miscellaneous'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>(CSS) - Updated Support Policy for Virtualization of SQL Server</title><content type='html'>&lt;p&gt;Microsoft updated the Support Policy for running SQL Server Virtualized today.&amp;#160; The CSS Team Blog has a post that provides a quick overview of what's changed as well as a link to the new policy:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://blogs.msdn.com/psssql/archive/2009/09/03/another-update-for-the-support-policy-for-virtualization-for-sql-server.aspx" href="http://blogs.msdn.com/psssql/archive/2009/09/03/another-update-for-the-support-policy-for-virtualization-for-sql-server.aspx"&gt;http://blogs.msdn.com/psssql/archive/2009/09/03/another-update-for-the-support-policy-for-virtualization-for-sql-server.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Now I haven't personally looked at the SVVP approved vendor list in a long time but I decided to take a glance today at it, and there are a bunch of new approved platforms:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.windowsservercatalog.com/results.aspx?&amp;amp;bCatID=1521&amp;amp;cpID=0&amp;amp;avc=0&amp;amp;ava=0&amp;amp;avq=0&amp;amp;OR=1&amp;amp;PGS=25" href="http://www.windowsservercatalog.com/results.aspx?&amp;amp;bCatID=1521&amp;amp;cpID=0&amp;amp;avc=0&amp;amp;ava=0&amp;amp;avq=0&amp;amp;OR=1&amp;amp;PGS=25"&gt;http://www.windowsservercatalog.com/results.aspx?&amp;amp;bCatID=1521&amp;amp;cpID=0&amp;amp;avc=0&amp;amp;ava=0&amp;amp;avq=0&amp;amp;OR=1&amp;amp;PGS=25&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The key topics to make note of in the updated policy which can be found on the following KB Article are listed in the &lt;strong&gt;Restrictions and Limitations &lt;/strong&gt;and include the inclusion of Guest Failover Clustering Support if you are on Windows Server 2008 and meet the requirements of Windows Server 2008 Failover Clustering, and the lack of support for Virtualization Snapshots.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-6212689487420688500?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/6212689487420688500/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2009/09/css-updated-support-policy-for.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/6212689487420688500'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/6212689487420688500'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2009/09/css-updated-support-policy-for.html' title='(CSS) - Updated Support Policy for Virtualization of SQL Server'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-1956943963221054816</id><published>2009-01-17T21:28:00.003-05:00</published><updated>2009-01-17T22:26:00.306-05:00</updated><title type='text'>Moving to SQLBlog.com</title><content type='html'>At the beginning of the week I was contacted by Adam Machanic and asked if I was interested in moving my blog from Blogger to SQLBlog.com which is run by Adam, and Peter Debetta.  This was originally something that I thought would be easy to do, but when it came down to it and I had to make a decision it was really hard to do.  I've spent the last year blogging on this site, building a reader base, and using the content here to help answer questions on various forums.  Currently I get just under 200 hits a day and have over 50 subscribed readers to this blog, so why would I want to move my blog?&lt;br /&gt;&lt;br /&gt;Well, the main reason is the extended reach that exists for &lt;a href="http://sqlblog.com/blogs/jonathan_kehayias/"&gt;SQLBlog.com &lt;/a&gt;due to the other bloggers who blog there including &lt;a href="http://sqlblog.com/blogs/kalen_delaney"&gt;Kalen Delaney&lt;/a&gt;, &lt;a href="http://sqlblog.com/blogs/kevin_kline"&gt;Kevin Kline&lt;/a&gt;, &lt;a href="http://sqlblog.com/blogs/adam_machanic"&gt;Adam Machanic&lt;/a&gt;, &lt;a href="http://sqlblog.com/blogs/simon_sabin"&gt;Simon Sabin&lt;/a&gt;, &lt;a href="http://sqlblog.com/blogs/peter_debetta"&gt;Peter Debetta&lt;/a&gt;, &lt;a href="http://sqlblog.com/blogs/aaron_bertrand"&gt;Aaron Bertrand&lt;/a&gt;, and numerous others.  Now some might call me a sell out, but in reality the whole reason that we blog is to have people read what we write.  I've been pretty successful building readership on my own, but by blogging at &lt;a href="http://sqlblog.com/blogs/jonathan_kehayias/"&gt;SQLBlog.com&lt;/a&gt;, I can grow my readership even further and faster.&lt;br /&gt;&lt;br /&gt;So that being said, if you follow me here, I hope you will continue to follow me on SQLBlog.com.  I plan to leave this blog in place since there are thousands of links to its content online and I would hate to orphan those links.  You can follow my new posts on the SQLBlog RSS feed for my new blog at:&lt;br /&gt;&lt;br /&gt; &lt;a href="http://sqlblog.com/blogs/jonathan_kehayias/rss.aspx"&gt;http://sqlblog.com/blogs/jonathan_kehayias/rss.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The link to the actual blog is:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://sqlblog.com/blogs/jonathan_kehayias/"&gt;http://sqlblog.com/blogs/jonathan_kehayias/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-1956943963221054816?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://sqlblog.com/blogs/jonathan_kehayias/' title='Moving to SQLBlog.com'/><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/1956943963221054816/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2009/01/moving-to-sqlblogcom.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/1956943963221054816'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/1956943963221054816'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2009/01/moving-to-sqlblogcom.html' title='Moving to SQLBlog.com'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-6447984207774349931</id><published>2009-01-16T21:15:00.002-05:00</published><updated>2009-02-17T02:01:45.598-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Miscellaneous'/><title type='text'>Wordle and blog content</title><content type='html'>This post has been migrated to my new blog on SQLBlog.com.  You can find this post at the following address:&lt;br /&gt;&lt;a title="http://sqlblog.com/blogs/jonathan_kehayias/archive/2009/01/16/wordle-and-blog-content.aspx" href="http://sqlblog.com/blogs/jonathan_kehayias/archive/2009/01/16/wordle-and-blog-content.aspx"&gt;http://sqlblog.com/blogs/jonathan_kehayias/archive/2009/01/16/wordle-and-blog-content.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-6447984207774349931?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/6447984207774349931/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2009/01/wordle-and-blog-content.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/6447984207774349931'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/6447984207774349931'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2009/01/wordle-and-blog-content.html' title='Wordle and blog content'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-4195486574322581688</id><published>2009-01-15T08:23:00.000-05:00</published><updated>2009-01-15T08:23:00.852-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Miscellaneous'/><title type='text'>Windows Live Writer 2009 Released</title><content type='html'>&lt;p&gt;... and yes this blog post was made with the newest non-Beta version of the tool.&amp;#160; I usually just stick to post regarding SQL Server, but this one has nothing to do with SQL Server aside from the fact that I use Windows Live Writer to Blog about SQL.&amp;#160; If you have a blog, are new to blogging, or are planning on blogging in the future, give Live Writer a look test.&amp;#160; It is free, and it connects to most public blogging sites without any real configuration.&amp;#160; All you have to do is install it, point it to your blog, provide your username and password and it is ready to publish anything you type up.&lt;/p&gt;  &lt;p&gt;&lt;a title="http://download.live.com/writer" href="http://download.live.com/writer"&gt;http://download.live.com/writer&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Some reasons I use Live Writer:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;I can start a new blog entry and save it locally when I get ideas that I'd like to blog about but don't have the time to dedicate to writing the entry.&lt;/li&gt;    &lt;li&gt;It has a Microsoft Word like interface that is familiar.&lt;/li&gt;    &lt;li&gt;It accepts plugins that allow you to do things like add tag clouds, insert videos, pictures, formatted code (this doesn't work out so hot with blogger.com as I learned a few months back due to CSS issues and overlaps).&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;You can also manage multiple blogs with a single install of Live Writer.&amp;#160; I think it is one of the better tools I have in my blogging toolbox.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-4195486574322581688?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/4195486574322581688/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2009/01/windows-live-writer-2009-released.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/4195486574322581688'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/4195486574322581688'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2009/01/windows-live-writer-2009-released.html' title='Windows Live Writer 2009 Released'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-2839392251341398122</id><published>2009-01-14T11:15:00.001-05:00</published><updated>2009-01-14T11:15:41.493-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Rants'/><title type='text'>Time to Rant : Applications and Administrator Rights</title><content type='html'>&lt;p&gt;It is 2009, and I am shocked to find that applications today still show up with a requirement to be a sysadmin on SQL Server, and in the case of one particular application I am helping troubleshoot today, a Local Administrator on the SQL Server machine.&amp;#160; As an application developer myself, I understand the due diligence required to properly design an application to follow proper security best practices, and it isn't hard to do if you do it up front.&amp;#160; Since I am not one to roll over on security I am willing to spend the hours/days to figure out the appropriate rights necessary for an application to work in SQL without being a sysadmin, but I don't know many people who can/will do that much leg work.&lt;/p&gt;  &lt;p&gt;So why does the app need to be a sysadmin in the first place?&amp;#160; All to often it is just because that is how it was written, and it makes it easiest.&amp;#160; Often there is absolutely no need to be a sysadmin.&amp;#160; SecurityAdmin and DBCreator roles are initially needed to do the install so that the login can create the database for the app and setup security properly for it.&amp;#160; After this, DBO rights to the database is all that it actually needs, and you can drop the server level roles from the login.&lt;/p&gt;  &lt;p&gt;Another place I see that apps need elevated rights is where the application has builtin administrative functions.&amp;#160; One app I have seen has a console that will allow the user to change max server memory for SQL Server from the application.&amp;#160; Thank you no, that is my job, and I don't want/need some application admin playing with my server configuration.&amp;#160; Why do application developers think that this kind of thing is a good idea?&amp;#160; We already have applications to manage SQL Server with.&amp;#160; I think that this is one of the reasons that the quality of applications that are out there has decreased in recent years.&amp;#160; Rather than create a focused application that solves one problem, it seems like application vendors want to do it all, which generally only means one thing, they won't do any of it very good.&lt;/p&gt;  &lt;p&gt;So that leaves a question for the community of readers:&amp;#160; What do you do with applications like this?&amp;#160; I know in past discussions on SQL Server Central that some people use virtualized SQL Servers to solve this problem, and isolate the database on its own VM, but is that really a solution?&amp;#160; Now you get server sprawl and added licensing costs because the application, for lack of a better word, sucks?&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-2839392251341398122?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/2839392251341398122/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2009/01/time-to-rant-applications-and.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2839392251341398122'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2839392251341398122'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2009/01/time-to-rant-applications-and.html' title='Time to Rant : Applications and Administrator Rights'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-1754720100587318234</id><published>2009-01-13T15:46:00.001-05:00</published><updated>2009-01-13T15:46:27.505-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Saturdays'/><title type='text'>oPass User Group Presentation</title><content type='html'>&lt;p&gt;This thread is a place holder for the Presentation Slide Deck and Demo Code from the oPass User Group.&amp;#160; It will be updated with complete information after the Session.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-1754720100587318234?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/1754720100587318234/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2009/01/opass-user-group-presentation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/1754720100587318234'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/1754720100587318234'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2009/01/opass-user-group-presentation.html' title='oPass User Group Presentation'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-2889023888265316103</id><published>2009-01-12T22:13:00.000-05:00</published><updated>2009-01-12T22:13:00.988-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Connect Feedbacks'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2008'/><title type='text'>SQL Server 2008 Express SQL Agent won't start</title><content type='html'>&lt;p&gt;Yep, you read that right.&amp;#160; I did say SQL Server 2008 Express SQL Agent, and so will your services snapin if you install SQL Server 2008 Express, but you won't be able to use it.&amp;#160; Apparently there was some miscommunication/ lack of communication at Microsoft regarding the installation of SQL Agent with SQL Express, and the result is a disable SQL Agent Service that won't start no matter what you try to do.&amp;#160; This is documented in the following connect feedback:&lt;/p&gt;  &lt;p&gt;&lt;a title="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=351806&amp;amp;wa=wsignin1.0" href="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=351806&amp;amp;wa=wsignin1.0"&gt;https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=351806&amp;amp;wa=wsignin1.0&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;If you attempt to start the service you will receive the following error message:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;The service cannot be started, either because it is disabled or because it has no enabled devices associated with it. [0x80070422]&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;and trying to enable the service to start automatically will result in:&lt;/p&gt;  &lt;p&gt;&lt;b&gt;The request is not supported. [0x80070032]&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;This is by design according to the connect response from Microsoft, though it is not the ideal situation and is certain to cause a lot of confusion in the community.&amp;#160; If you want to use the SQL Agent, you need to install one of the pay versions of SQL Server.&amp;#160; You can still however, use sqlcmd.exe, batch files, and the Windows Task Scheduler to replace the SQL Agent free, or for a lot less than the cost of a single license for SQL Standard hope over to the SQL Sentry site, and purchase a copy of &lt;a href="http://www.sqlsentry.net/event-manager/windows-task-scheduler-standard.asp"&gt;SQL Sentry Event Manager&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Now I will be quite honest and say that I haven't yet tried the Event Manager, but SQL Sentry has a great reputation for creating top quality applications and comes highly recommended by colleagues that I trust and respect.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-2889023888265316103?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/2889023888265316103/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2009/01/sql-server-2008-express-sql-agent-won.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2889023888265316103'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2889023888265316103'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2009/01/sql-server-2008-express-sql-agent-won.html' title='SQL Server 2008 Express SQL Agent won&amp;#39;t start'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-5634311635622197327</id><published>2009-01-08T08:45:00.000-05:00</published><updated>2009-01-08T08:45:00.246-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>Other Blogs that you should be Watching</title><content type='html'>&lt;p&gt;I committed to blogging about other SQL blogs in the community after &lt;a href="http://www.statisticsio.com"&gt;Jason Massie&lt;/a&gt; gave me a bump on his blog.&amp;#160; So this week I spent some time reading over some of the blogs in my reader and finding ones that don't have many posts yet, but have demonstrated a sustained interest in blogging somewhat frequently.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://tjaybelt.blogspot.com/"&gt;TJay Belt's Thoughts&lt;/a&gt; - TJay Belt&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;TJay started blogging consistently before PASS 2008, and has quite an amazing blog roll on his site.&amp;#160; I made a reminder to come back to it and look at what feeds he might have of interest that I don't yet.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;a href="http://www.straightpathsql.com/blog"&gt;StraightPath Solutions&lt;/a&gt; - Mike Walsh&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;I usually don't recommend business based blogs, but Mike Walsh dedicates a good bit of time to helping people on the forums and Newsgroups for free, and he commented on a post here this week so I had to check out his blog the other day anyway.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;a href="http://facility9.com/"&gt;Facility 9&lt;/a&gt; - Jeremiah Peschka&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;I know Jeremiah from Twitter, and he is always doing performance tuning it would seem from his Tweets, but his blog covers more than just that.&amp;#160; &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;If you have a blog you'd like reviewed, send me an email, and I'll add it to my feed reader and see what you are all about.&amp;#160; I think that almost every blog post I see is interesting in one way or another, so even if I don't put you in a post like this, I will be subscribed to your blog.&amp;#160; :-)&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-5634311635622197327?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/5634311635622197327/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2009/01/other-blogs-that-you-should-be-watching.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/5634311635622197327'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/5634311635622197327'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2009/01/other-blogs-that-you-should-be-watching.html' title='Other Blogs that you should be Watching'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-91936007597305292</id><published>2009-01-08T00:44:00.001-05:00</published><updated>2009-01-08T00:44:37.202-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PASS Summit'/><title type='text'>PASS Governance Board posts Financial's Information</title><content type='html'>&lt;p&gt;PASS is a not for profit organization for SQL Server Professionals that is widely known.&amp;#160; For years however, one thing about PASS was that it was not open with a lot of information like its financial statements and minutes from board meetings.&amp;#160; Well that has finally changed, and any member of PASS can login to the PASS site with their username and password and now see this information on the new Governance sub-site:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.sqlpass.org/AboutPASS/Governance.aspx"&gt;http://www.sqlpass.org/AboutPASS/Governance.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;For me this is a very important thing, especially given the amount of money that is handled by PASS for a given year.&amp;#160; I am not saying anything negative about PASS or implying that anything incorrect has been done by anyone involved with the Board currently or in the past, so please don't try and read into my comments on this post and make them into something they are not.&amp;#160; The level of transparency that the Board is now providing to the community is a good thing, they even posted information going back to 2004 for audited financial's.&lt;/p&gt;  &lt;p&gt;This is definitely a step in the right direction, and having the January 2009 meeting minutes available for review is taking it the next step as well.&amp;#160; While I don't run a user group, this kind of information is good for group leaders to be able to see.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-91936007597305292?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/91936007597305292/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2009/01/pass-governance-board-posts-financial.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/91936007597305292'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/91936007597305292'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2009/01/pass-governance-board-posts-financial.html' title='PASS Governance Board posts Financial&amp;#39;s Information'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-2315099078484488621</id><published>2009-01-07T14:03:00.001-05:00</published><updated>2009-01-07T14:07:35.787-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Query Processing'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA Tutorials'/><category scheme='http://www.blogger.com/atom/ns#' term='Best Practices'/><title type='text'>Free eBook from RedGate : Dissecting SQL Server Execution Plans (Grant Fritchey)</title><content type='html'>&lt;p&gt;For the last few months I have been working with Understanding SQL Server Execution Plans at a very basic level to provide information on how to get Execution Plans from SQL, how to read them, how to find the information contained in them, and what to look for as flags of potential areas of concern when performance tuning code.&amp;#160; Last night I was having a chat with &lt;a href="http://jimmcleod.net/blog/"&gt;Jim McLeod&lt;/a&gt;, running some thoughts by him when he mentioned this eBook, so I did a quick search and located a free copy from RedGate which I promptly download from:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.red-gate.com/specials/Grant.htm?utm_content=Grant080623" href="http://www.red-gate.com/specials/Grant.htm?utm_content=Grant080623"&gt;http://www.red-gate.com/specials/Grant.htm?utm_content=Grant080623&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;All I can say is WOW.&amp;#160; This has to be the best reference I have ever seen on Execution Plans in SQL Server.&amp;#160; My hats off to &lt;a href="http://scarydba.wordpress.com/"&gt;Grant Fritchey&lt;/a&gt; for first putting this together, but then for making the concepts simple enough that you really don't have to be a Sr DBA to figure out what is happening.&amp;#160; I'd highly recommend this eBook to anyone who writes or reviews TSQL code.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-2315099078484488621?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/2315099078484488621/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2009/01/free-ebook-from-redgate-dissecting-sql.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2315099078484488621'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2315099078484488621'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2009/01/free-ebook-from-redgate-dissecting-sql.html' title='Free eBook from RedGate : Dissecting SQL Server Execution Plans (Grant Fritchey)'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-1888232621183262601</id><published>2009-01-06T21:39:00.003-05:00</published><updated>2009-02-17T02:18:57.470-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DBA Tutorials'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Error Messages'/><title type='text'>Error: 5123, Severity: 16, State: 1 when moving TempDB</title><content type='html'>This post has been migrated to my new blog on SQLBlog.com. You can find this post at the following address: &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jonathan_kehayias/archive/2009/01/06/error-5123-severity-16-state-1-when-moving-tempdb.aspx"&gt;http://sqlblog.com/blogs/jonathan_kehayias/archive/2009/01/06/error-5123-severity-16-state-1-when-moving-tempdb.aspx&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-1888232621183262601?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/1888232621183262601/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2009/01/error-5123-severity-16-state-1-when.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/1888232621183262601'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/1888232621183262601'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2009/01/error-5123-severity-16-state-1-when.html' title='Error: 5123, Severity: 16, State: 1 when moving TempDB'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-2485976702050342028</id><published>2009-01-05T14:38:00.001-05:00</published><updated>2009-01-05T14:38:38.962-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2005'/><title type='text'>Think you can replace DBCC INPUTBUFFER with the DMV's. Better check again.</title><content type='html'>&lt;p&gt;I was working on a different blog post this morning when I happened upon this little problem.&amp;#160; I was trying to implement statement level auditing of a database without using a SQL Trace in SQL Server 2005 for SOX Auditing, very similar to what we can do with the Server Audits in SQL Server 2008, when I happened upon a couple of posts on the forums that I had responded to in the past.&amp;#160; The first was a post asking how to do this very thing where I posted to use a SQL Trace, ironic I know, but later a post was made with a link to a &amp;quot;Oriental/Asian&amp;quot; (trying to be politically correct because I can't tell if the characters are Chinese or Japanese, but I suspect Chinese because it is at &lt;a href="http://blogs.csdn.net/"&gt;http://blogs.csdn.net/&lt;/a&gt; which looks more like it should be Chinese) &lt;a href="http://blog.csdn.net/Haiwer/archive/2008/10/04/3016270.aspx"&gt;blog that shows how to accomplish the task using DBCC INPUTBUFFER&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;That is great, and the code works out perfectly, but I am on SQL 2005, so I should be able to just hit up the DMV's for this information right?&amp;#160; Actually the answer is NO YOU CAN'T.&amp;#160; I should have recalled this from last February when UC from Microsoft replied to the following post:&lt;/p&gt;  &lt;h5&gt;&lt;a href="http://social.msdn.microsoft.com/forums/en-US/transactsql/thread/d1dbb675-ce11-4797-91f5-fa4940c3b27e/"&gt;Alternative to DBCC INPUTBUFFER/sys.dm_exec_sql_text?&lt;/a&gt;&lt;/h5&gt;  &lt;p&gt;I tried to use a number of the DMV's, sys.dm_exec_requests, sys.dm_exec_connections, sys.sysprocesses, and all of them return, the code of the trigger when run inside of the trigger.&amp;#160; I don't get how something this simple was overlooked, especially when the DMV's are supposed to be our replacement for the older code and structures, or are they?&amp;#160; The BOL entry for &lt;a href="http://msdn.microsoft.com/en-us/library/ms187730(SQL.90).aspx"&gt;DBCC INPUTBUFFER&lt;/a&gt; doesn't have the standard deprecation announcement that can be found on other items that the DMV's should replace, so it really isn't intended in the current releases at least for the DMV's to be able to replace this functionality.&lt;/p&gt;  &lt;p&gt;The good news is that according to UC, Microsoft is aware of this and working to fix it.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-2485976702050342028?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/2485976702050342028/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2009/01/think-you-can-replace-dbcc-inputbuffer.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2485976702050342028'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2485976702050342028'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2009/01/think-you-can-replace-dbcc-inputbuffer.html' title='Think you can replace DBCC INPUTBUFFER with the DMV&amp;#39;s. Better check again.'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-1399300750683902578</id><published>2009-01-04T00:33:00.001-05:00</published><updated>2009-01-04T00:33:45.839-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Miscellaneous'/><title type='text'>Goals for 2009</title><content type='html'>&lt;p&gt;A lot of people have been blogging lately about their New Years Resolutions and goals for 2009.&amp;#160; I had intended to blog this earlier, but I have been busy working on the Extended Events Manager app that I wrote for the SQL Heroes contest.&amp;#160; I prefer to set goals rather than make resolutions since goals are measurable and resolutions tend to not be accomplished.&amp;#160; &lt;/p&gt;  &lt;p&gt;My number one goal for this year is to continue to dedicate a block of time to my family each day, since they are the number one priority in my life, and the older my daughter gets, the faster time seems to go by, especially with a second child due in June.&amp;#160; My second goal is to attend and graduate from the US Army Drill Sergeant Academy to further my military career.&lt;/p&gt;  &lt;p&gt;As far as technical and career development my goals would be as follows:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Remain consistent in technical blog posts averaging 3 a week for the year.&lt;/li&gt;    &lt;li&gt;Finish coding on the &lt;a href="http://www.codeplex.com/ExtendedEventManager/"&gt;Extended Events Manager App&lt;/a&gt; to make it a one stop shop for creating, altering and consuming Extended Events in SQL Server 2008.&lt;/li&gt;    &lt;li&gt;Continue to answer posts on the &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/sqldatabaseengine/threads"&gt;MSDN&lt;/a&gt; and &lt;a href="http://www.sqlservercentral.com/Forums/"&gt;SqlServerCentral Forums&lt;/a&gt;.&lt;/li&gt;    &lt;li&gt;Present at least one session at a major event, (ie TechEd, SQLConnections, PASS Summit, etc.)&lt;/li&gt;    &lt;li&gt;Submit an article for publication at least once a quarter to an online site or magazine publication.&lt;/li&gt;    &lt;li&gt;Continue to present sessions at SQL Saturday and local Code Camp Events.&lt;/li&gt;    &lt;li&gt;Complete my MCITP SQL Server 2008 Administrator Certification.&lt;/li&gt;    &lt;li&gt;Take the Oracle Certified Associate Database Administrator Certification test.&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;I have a few other goals that I would like to accomplish as well, time permitting, but we'll see how the above eight pan out first.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-1399300750683902578?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/1399300750683902578/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2009/01/goals-for-2009.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/1399300750683902578'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/1399300750683902578'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2009/01/goals-for-2009.html' title='Goals for 2009'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-7505337796133478411</id><published>2008-12-31T20:40:00.000-05:00</published><updated>2009-01-01T13:43:42.722-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>Another Year Gone - 2008 in Review</title><content type='html'>&lt;p&gt;It is really amazing to look back on 2008, and see what all I have accomplished both personally as well as professionally.&amp;#160; At the start of 2008, I was completely unknown in the SQL Server Community and online.&amp;#160; I had asked a grand total of 4 questions on the forums and had never once answer someone else's question.&amp;#160; I had never written a blog post, or technical article online.&lt;/p&gt;  &lt;p&gt;To recap this year, I have replied over 5000 times to questions on MSDN forums, SQL Server Central Forums, and Microsoft Newsgroups.&amp;#160; I have posted 128 blog posts, written 2 articles for SQL Server Central and 28 articles on the &lt;a href="http://code.msdn.microsoft.com/SQLExamples"&gt;SQL Examples Site on Code Project&lt;/a&gt;.&amp;#160; I also did a Live Meeting for the PASS DBA Special Interest Group, and presented at 3 user groups and 4 different conferences this year.&amp;#160; &lt;/p&gt;  &lt;p&gt;If you are reading this and you haven't done a presentation, written a blog post, or online article, then hopefully this will motivate you to get your start.&amp;#160; If you think you don't know enough, or that people won't be interested, then try and do the presentation at your local user group first.&amp;#160; You'll be surprised with the outcome and amount of interest that there may be, I can almost guarantee it.&amp;#160; &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-7505337796133478411?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/7505337796133478411/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/another-year-gone-2008-in-review.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/7505337796133478411'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/7505337796133478411'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/another-year-gone-2008-in-review.html' title='Another Year Gone - 2008 in Review'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-1261956514995988502</id><published>2008-12-29T06:44:00.000-05:00</published><updated>2008-12-29T06:44:00.341-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='TSQL'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2005'/><title type='text'>ISNUMERIC functions differently SQL 2000 to SQL 2005</title><content type='html'>&lt;p&gt;Did you know that the ISNUMERIC function works differently between SQL Server 2000 and SQL Server 2005?&amp;#160; I didn't realize it until the other day when a &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/sqldatabaseengine/thread/e6833434-247c-48ff-86d7-d5f392b569b6"&gt;post on the forums&lt;/a&gt; made me dig into it a little bit.&lt;/p&gt;  &lt;p&gt;The difference is documented in the books online for &lt;a href="http://msdn.microsoft.com/en-us/library/ms178653(SQL.90).aspx"&gt;sp_dbcmptlevel&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;SQL Server 2000 and SQL Server 2005 Compatibility Level 80&lt;/strong&gt;    &lt;br /&gt;&lt;em&gt;In SELECT ISNUMERIC('&amp;lt;string&amp;gt;'), embedded commas within &amp;lt;string&amp;gt; are significant.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;For example, the following &lt;code&gt;SELECT ISNUMERIC('121212,12')&lt;/code&gt; query returns 0. This indicates that the string &lt;code&gt;121212,12&lt;/code&gt; is not numeric.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;SQL Server 2005 Compatibility Level 90     &lt;br /&gt;&lt;/strong&gt;&lt;em&gt;In SELECT ISNUMERIC('&amp;lt;string&amp;gt;'), embedded commas within &amp;lt;string&amp;gt; are ignored.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;For example, the following &lt;code&gt;SELECT ISNUMERIC('121212,12')&lt;/code&gt; query returns 1. This indicate that the string &lt;code&gt;121212,12&lt;/code&gt; is numeric.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;Pretty interesting, only the way to maintain the functionality if you actually expect it to return a zero (0) for commas means that you lose the ability to use things like CROSS APPLY, PIVOT, UNPIVOT, Common Table Expressions (CTE's), SQL CLR, and numerous other features in SQL Server 2005.&amp;#160; The only real way to go around this would be to change code to function differently and test for the commas or do a bulk update of the column to replace commas with a different symbol to force a failure or do an inline REPLACE in the SELECT.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-1261956514995988502?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/1261956514995988502/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/isnumeric-functions-differently-sql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/1261956514995988502'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/1261956514995988502'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/isnumeric-functions-differently-sql.html' title='ISNUMERIC functions differently SQL 2000 to SQL 2005'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-4624661850741572632</id><published>2008-12-23T06:08:00.000-05:00</published><updated>2008-12-23T06:08:00.523-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>Other Blogs that you should be Watching</title><content type='html'>&lt;p&gt;Following my blog post from yesterday where I listed the major blogs from the SQL Server Team that you should follow, today, I am going to list some &amp;quot;unknown&amp;quot; blogs that you might consider following.&amp;#160; This post is more of a &amp;quot;pay it forward&amp;quot; type of post since Jason Massie, did a similar post and listed my blog in his list of ten blogs to follow and it tripled traffic to my blog.&amp;#160; &lt;/p&gt;  &lt;p&gt;In no particular order:&lt;/p&gt;  &lt;p&gt;Aaron Alton is a rising star in the SQL Server Community, and a fellow Moderator in the MSDN SQL Server Forums.&amp;#160; His blog can be found at&amp;#160; &lt;a href="http://thehobt.blogspot.com"&gt;http://thehobt.blogspot.com&lt;/a&gt;.&amp;#160; Look to find posts similar to mine where the focus is around questions commonly asked on the MSDN forums.&lt;/p&gt;  &lt;p&gt;Sankar Reddy is another Moderator from the MSDN SQL Server Forums as well who blogs at &lt;a href="http://sankarreddy.spaces.live.com/"&gt;http://sankarreddy.spaces.live.com/&lt;/a&gt;.&amp;#160; Again his posts should be similar in nature to my own, and follow common problems seen in the community.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlinthewild.co.za/"&gt;Gail Shaw&lt;/a&gt; is a fellow MVP, and a consistent top performer on the SQL Server Central forums.&amp;#160; She covered the PASS Summit live from PASS Summit, and is definitely worth following.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-4624661850741572632?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/4624661850741572632/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/other-blogs-that-you-should-be-watching.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/4624661850741572632'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/4624661850741572632'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/other-blogs-that-you-should-be-watching.html' title='Other Blogs that you should be Watching'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-6656866662071293930</id><published>2008-12-22T22:29:00.001-05:00</published><updated>2008-12-22T22:29:11.845-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Security'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2008'/><title type='text'>Microsoft Security Advisory (961040): Vulnerability in SQL Server Could Allow Remote Code Execution</title><content type='html'>&lt;p&gt;This has been a hot topic online recently, and Jason Massie brought it up last week, and I have seen it blogged a few different places, but now it has a MSRC Advisory for it, and chances are, that your server is affected and you can't do much about it at the current point in time:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.microsoft.com/technet/security/advisory/961040.mspx" href="http://www.microsoft.com/technet/security/advisory/961040.mspx"&gt;http://www.microsoft.com/technet/security/advisory/961040.mspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Since these Advisories are constantly updated to reflect the newest information, I am not going to rehash it here, but make sure that you read the Advisory and at least know whether you are affected and what your level of risk is.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-6656866662071293930?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/6656866662071293930/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/microsoft-security-advisory-961040.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/6656866662071293930'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/6656866662071293930'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/microsoft-security-advisory-961040.html' title='Microsoft Security Advisory (961040): Vulnerability in SQL Server Could Allow Remote Code Execution'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-1155980605574453649</id><published>2008-12-22T07:37:00.000-05:00</published><updated>2008-12-22T07:37:00.834-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>Blogs you should be watching</title><content type='html'>&lt;p&gt;If you are reading this, I hope that you are watching my blog, or that you have subscribed to it in a RSS feed reader.&amp;#160; However, if you haven't or you don't that is no matter, and isn't the real topic of this posting.&amp;#160; The real purpose of this post is to make you aware of a specific set of blogs at Microsoft that you should be following if SQL Server is your primary area of responsibility.&lt;/p&gt;  &lt;p&gt;Number one of the list has to be the &lt;a href="http://blogs.msdn.com/sqlreleaseservices/default.aspx"&gt;Microsoft SQL Server Release Services&lt;/a&gt; blog.&amp;#160; This is the primary location to find out about new releases happening regarding SQL Server, from major releases, to service packs and cumulative updates, it is announced here.&amp;#160; This is how I stat up to date with when releases occur for SQL Server.&lt;/p&gt;  &lt;p&gt;Number two on the list would be the &lt;a href="http://blogs.msdn.com/psssql/default.aspx"&gt;CSS SQL Server Engineers&lt;/a&gt; blog for SQL Server.&amp;#160; A few people post here, all from the Customer Service and Support team for SQL Server, but the posts are generally centered around problems that the CSS team is seeing in their day to day work.&amp;#160; You can get a good heads up on solutions to popular problems by simply monitoring this blog.&lt;/p&gt;  &lt;p&gt;Number three on the list would be the &lt;a href="http://blogs.msdn.com/sqlserverstorageengine/default.aspx"&gt;SQL Server Storage Engine&lt;/a&gt; blog.&amp;#160; This is one of my favorite SQL Server Team blogs, mainly because it has to deal with the side of SQL that I deal with primarily.&amp;#160; However, in the grand scheme of things, for most people, it is probably the third most important blog to watch behind the above two.&lt;/p&gt;  &lt;p&gt;If you are a developer, and not a DBA, swap the above number three with the following number four which is &lt;a href="http://blogs.msdn.com/sqlprogrammability/default.aspx"&gt;SQL Programmability &amp;amp; API Development Team Blog&lt;/a&gt;.&amp;#160; This blog has pointers about how to use the programmability features of SQL Server, as well as how to performance tune code, and the SQL instance for specific scenarios.&lt;/p&gt;  &lt;p&gt;Number five on my list would be the &lt;a href="http://blogs.msdn.com/mssqlisv/default.aspx"&gt;Microsoft SQL ISV Program Management Team&lt;/a&gt; blog.&amp;#160; A note here is that if you watch the &lt;a href="http://blogs.msdn.com/sqlprogrammability/default.aspx"&gt;SQL Programmability &amp;amp; API Development Team Blog&lt;/a&gt; as well, you will probably see a bit of overlap since these two teams seem to work hand in hand with each other to solve ISV problems at times.&amp;#160; The ISV team may also solve a problem that the Programmability team finds interesting enough to share with their followers and they will repost it, but there are non-overlapping posts between the two that make both worth following.&lt;/p&gt;  &lt;p&gt;The last SQL Team blog to watch is the &lt;a href="http://blogs.technet.com/sqlos/default.aspx"&gt;SQL Server SQLOS team blog&lt;/a&gt;.&amp;#160; I place this one last only because it doesn't have the posting frequency that other blogs do. The information on this blog is just as important, it just isn't updated with any regular frequency.&amp;#160; However, if an update is posted, you probably would be good to know about it.&lt;/p&gt;  &lt;p&gt;That's all folks.&amp;#160; If you are not following the above blogs, I highly recommend it.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-1155980605574453649?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/1155980605574453649/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/blogs-you-should-be-watching.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/1155980605574453649'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/1155980605574453649'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/blogs-you-should-be-watching.html' title='Blogs you should be watching'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-5955852669519616037</id><published>2008-12-19T09:47:00.001-05:00</published><updated>2008-12-19T09:48:26.915-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2008'/><title type='text'>Service Broker External Activator Documentation</title><content type='html'>&lt;p&gt;In October, the SQL Server 2008 Feature Pack became available and included in it a new External Activator for Service Broker.&amp;#160; Documentation is lack luster in the Books Online, but documentation actually comes with the installation that you would probably never find unless you knew about it.&amp;#160; Thanks to &lt;a href="http://sqlblog.com/blogs/greg_low/"&gt;The Bit Bucket (Greg Low)&lt;/a&gt; from &lt;a href="http://sqldownunder.com/"&gt;SQL Down Under&lt;/a&gt; who pointed out that documentation ships with the External Activator in the C:\Program Files\Service Broker folder.&amp;#160; You can find a Word document called SSBEA.docx in this path that has the documentation.&lt;/p&gt;  &lt;p&gt;To download the Feature Pack see:&lt;/p&gt;  &lt;h5&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=228DE03F-3B5A-428A-923F-58A033D316E1"&gt;Download details: Microsoft &lt;em&gt;SQL Server 2008 Feature Pack&lt;/em&gt;, October &lt;em&gt;2008&lt;/em&gt;&lt;/a&gt;&lt;/h5&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-5955852669519616037?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/5955852669519616037/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/service-broker-external-activator.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/5955852669519616037'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/5955852669519616037'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/service-broker-external-activator.html' title='Service Broker External Activator Documentation'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-8060948871421768799</id><published>2008-12-17T06:36:00.000-05:00</published><updated>2008-12-17T06:36:00.127-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Free Tools'/><title type='text'>SQL Toolset: SqlQueryStress</title><content type='html'>&lt;p&gt;Have you ever had&amp;#160; need to hammer on a database server to build load against it?&amp;#160; I recently had the need to do this to test some stuff out, and I was going to write a small C# application to do it.&amp;#160; Instead I found a great tool online for free by SQL Server MVP Adam Machanic:&lt;/p&gt;  &lt;h5&gt;&lt;a href="http://sqlblog.com/blogs/adam_machanic/archive/2007/06/28/new-version-of-sqlquerystress-released.aspx"&gt;Adam Machanic : New version of SQLQueryStress released&lt;/a&gt;&lt;/h5&gt;  &lt;p&gt;This is a pretty useful tool and you can't beat the price tag, FREE.&amp;#160; It has a easy to use interface, and allows for a good amount of configuration.&amp;#160; The database configuration page has two different connections, one for the Base Load run, and one to pull Parameters from:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_CSUuS5p4wm0/SUMt0BH8gZI/AAAAAAAAAGA/4u6w5mTXePs/s1600-h/image%5B2%5D.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="160" alt="image" src="http://lh3.ggpht.com/_CSUuS5p4wm0/SUMt0iSFsRI/AAAAAAAAAGE/DiXCAUD7KKs/image_thumb.png?imgmax=800" width="244" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The parameterization settings allow you to pull a data set to be used for parameter values for the workload being run, and you can pull them from the same database on the same server, or specify a different connection and database.&lt;/p&gt;  &lt;p&gt;The main screen is really user friendly and provides large controls that provide information as the tests are running:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_CSUuS5p4wm0/SUMt1NELYII/AAAAAAAAAGI/i5PMUrwTKiQ/s1600-h/image%5B5%5D.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="166" alt="image" src="http://lh6.ggpht.com/_CSUuS5p4wm0/SUMt1T9NI7I/AAAAAAAAAGM/7PaXikc6wtY/image_thumb%5B1%5D.png?imgmax=800" width="244" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;If you provide a query with parameters in the code, you can click the Parameter Substitution button to specify the values to map to those parameters from another query:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_CSUuS5p4wm0/SUMt1o1ywiI/AAAAAAAAAGQ/xanCoe31koQ/s1600-h/image%5B8%5D.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="244" alt="image" src="http://lh3.ggpht.com/_CSUuS5p4wm0/SUMt11QEyZI/AAAAAAAAAGU/3ajSba4uEwQ/image_thumb%5B2%5D.png?imgmax=800" width="218" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;This is a really useful tool in my opinion and it has a number of uses for a DBA.&amp;#160; If you want to know how potentially problematic a piece of code may be, you can run a series of tests against the server.&amp;#160; If you want to see just how much load the server can take, you can easily stress it out with this tool.&amp;#160; As a point of reference, the settings in the images above are sufficient to run a 2 socket dual core server with 4GB RAM to 87% CPU sustained across all 4 cores.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-8060948871421768799?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/8060948871421768799/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/sql-toolset-sqlquerystress.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/8060948871421768799'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/8060948871421768799'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/sql-toolset-sqlquerystress.html' title='SQL Toolset: SqlQueryStress'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_CSUuS5p4wm0/SUMt0iSFsRI/AAAAAAAAAGE/DiXCAUD7KKs/s72-c/image_thumb.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-7250639813189579585</id><published>2008-12-17T00:37:00.001-05:00</published><updated>2008-12-17T00:37:53.686-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Connect Feedbacks'/><category scheme='http://www.blogger.com/atom/ns#' term='Extended Events'/><title type='text'>Connect Item: Enhancements to XEvents page_split Event</title><content type='html'>&lt;p&gt;One of my &amp;quot;things to blog&amp;quot; was how to use Extended Events in SQL Server 2008 to monitor page splits inside SQL Server.&amp;#160; This was a hot topic amongst MVP's recently, and I thought I would have time to get to it, but I didn't, and another MVP did.&amp;#160; Rather than post the same kind of thing over again, I'll send you to Eladio Rincon's blog post:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msmvps.com/blogs/eladio_rincon/archive/2008/12/07/using-xevents-extended-events-in-sql-server-2008-to-detect-which-queries-are-causing-page-splits.aspx"&gt;Using XEvents (Extended Events) in SQL Server 2008 to detect which queries are causing Page Splits&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;As I have said before, I think that Extended Events are one of the best kept secrets at Microsoft, and I am glad to see that others feel the same way.&amp;#160; However, like any product in its infancy, there is room to grow.&amp;#160; The page_split event is an extremely powerful event to capture, if only it could return the necessary information to make it really useful.&amp;#160; I submitted a connect feedback item:&lt;/p&gt;  &lt;p&gt;&lt;a title="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=388482" href="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=388482"&gt;https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=388482&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;which is targeted at getting the page_split event enhanced.&amp;#160; Now, I can't personally take credit for the idea behind this.&amp;#160; Paul Randal, Adam Machanic, and Greg Linwood all contributed to this information in the MVP groups, I came along after the fact, but it was suggested by a Developer at Microsoft that I put the connect item in to get votes on it, since connect items with votes get attention.&lt;/p&gt;  &lt;p&gt;How can this help you out?&amp;#160; Glad you asked.&amp;#160; The connect item is seeking to add additional columns to the events default payload, which is very inexpensive to do if the information is already available at the point in which the event is being fired.&amp;#160; Currently the only columns returned by the event are file_id and page_id.&amp;#160; Both pretty useful, but not to the level that the event could be.&amp;#160; Missing is database_id, which requires a synchronous action to be added to the event payload to collect.&amp;#160; If the allocation_id were added to the event, then we could do a lookup in sys.partitions and easily get not only the object_id, but also the index_id that is being split.&amp;#160; Using these, we can create aggregations across time to identify which indexes in our database(s) are causing the most splits.&amp;#160; Now lets add to this the split_point (begin, middle, end), and split_level (leaf or internal) and we now have a really good idea of what is happening inside our allocation structures, and we can begin to find problems that we might not have other wise found.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-7250639813189579585?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/7250639813189579585/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/connect-item-enhancements-to-xevents.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/7250639813189579585'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/7250639813189579585'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/connect-item-enhancements-to-xevents.html' title='Connect Item: Enhancements to XEvents page_split Event'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-5758182057329985646</id><published>2008-12-16T09:17:00.000-05:00</published><updated>2008-12-16T09:17:00.551-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Miscellaneous'/><title type='text'>Getting Windows Search to work inside Code Files</title><content type='html'>&lt;p&gt;&lt;/p&gt;  &lt;p&gt;Windows Search is a great tool, and the fact that you can search inside of documents for specific text helped me numerous times in college since I could generic search a folder of source information to find matches without having to actually scan (read) the documents myself.&amp;#160; You can see how to do this in the following image:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_CSUuS5p4wm0/SUMbsEngT3I/AAAAAAAAAF4/gpnCLry38ic/s1600-h/image%5B4%5D.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="598" alt="image" src="http://lh4.ggpht.com/_CSUuS5p4wm0/SUMbsVMP2fI/AAAAAAAAAF8/Fvgt-VkqJr4/image_thumb%5B2%5D.png?imgmax=800" width="706" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;However, since I started with SQL I have never been able to get it to search inside of my .sql/.vb/.cs code files.&amp;#160; With the forums migration on MSDN today, I spent most of the day goofing around in the NNTP Newsgroups for SQL where someone asked about searching inside code files.&amp;#160; A quick google search turned up the following:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;With Windows XP the default behaviour for searching within files will ignore .SQL files. &lt;/p&gt;    &lt;p&gt;To get around this you can add a registry setting which will force Windows to treat .SQL files as text so it can search within the file.&lt;/p&gt;    &lt;ol&gt;     &lt;li&gt;Open regedit &lt;/li&gt;      &lt;li&gt;Go to &lt;strong&gt;HKEY_CLASSES_ROOT\.sql&lt;/strong&gt;&lt;/li&gt;      &lt;li&gt;Add a new key &lt;strong&gt;PersistentHandler&lt;/strong&gt;&lt;/li&gt;      &lt;li&gt;Set the default value for the key to &lt;strong&gt;{5e941d80-bf96-11cd-b579-08002b30bfeb}&lt;/strong&gt;&lt;/li&gt;   &lt;/ol&gt;    &lt;p&gt;That&amp;#8217;s it. You can do this for any other file type as well.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;This information is thanks to the following blog post by Perry Stathopoulos:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://pstatho.wordpress.com/2007/08/20/getting-windows-to-search-within-sql-files/" href="http://pstatho.wordpress.com/2007/08/20/getting-windows-to-search-within-sql-files/"&gt;http://pstatho.wordpress.com/2007/08/20/getting-windows-to-search-within-sql-files/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;I had to log out and log back in for it to take effect, but one of our developers didn't have the same issue, so if it doesn't work, give a logoff or reboot a shot.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-5758182057329985646?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/5758182057329985646/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/getting-windows-search-to-work-inside.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/5758182057329985646'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/5758182057329985646'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/getting-windows-search-to-work-inside.html' title='Getting Windows Search to work inside Code Files'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_CSUuS5p4wm0/SUMbsVMP2fI/AAAAAAAAAF8/Fvgt-VkqJr4/s72-c/image_thumb%5B2%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-968184883171866656</id><published>2008-12-15T21:44:00.001-05:00</published><updated>2008-12-15T21:44:27.391-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2005'/><title type='text'>SQL Server 2005 SP3 is available!</title><content type='html'>&lt;p&gt;I am sure that I am behind on this but SP3 is now available for download:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ae7387c3-348c-4faa-8ae5-949fdfbe59c4"&gt;http://www.microsoft.com/downloads/details.aspx?FamilyID=ae7387c3-348c-4faa-8ae5-949fdfbe59c4&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-968184883171866656?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/968184883171866656/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/sql-server-2005-sp3-is-available.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/968184883171866656'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/968184883171866656'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/sql-server-2005-sp3-is-available.html' title='SQL Server 2005 SP3 is available!'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-3160792751035309309</id><published>2008-12-15T07:20:00.000-05:00</published><updated>2008-12-15T07:20:00.744-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MSDN Forums'/><category scheme='http://www.blogger.com/atom/ns#' term='TSQL'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>Drop All Indexes and Stats in one Script</title><content type='html'>&lt;p&gt;I am not sure why someone would want to do this, but it was asked on the forums, and I figured I would post the code I created to perform such a nightmarish operation.&amp;#160; As with any post that I make providing code that could be potentially damaging and dangerous, if you use it, you do so at your own risk.&amp;#160; Don't send me emails complaining that you got fired for deleting all the indexes with the scripts on this post.&amp;#160; I am not going to be able to help you fix it, and my recommendation is going to be restore a backup, and start scripting them all off if you still have a job.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;SQL Server 2000 Code&lt;/strong&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;code style="font-size: 12px"&gt;&lt;span style="color: blue"&gt;DECLARE &lt;/span&gt;&lt;span style="color: #434343"&gt;@ownername &lt;/span&gt;&lt;span style="color: blue"&gt;SYSNAME         &lt;br /&gt;DECLARE &lt;/span&gt;&lt;span style="color: #434343"&gt;@tablename &lt;/span&gt;&lt;span style="color: blue"&gt;SYSNAME         &lt;br /&gt;DECLARE &lt;/span&gt;&lt;span style="color: #434343"&gt;@indexname &lt;/span&gt;&lt;span style="color: blue"&gt;SYSNAME         &lt;br /&gt;DECLARE &lt;/span&gt;&lt;span style="color: #434343"&gt;@sql &lt;/span&gt;&lt;span style="color: blue"&gt;NVARCHAR&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;4000&lt;/span&gt;&lt;span style="color: gray"&gt;)         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;DECLARE &lt;/span&gt;&lt;span style="color: black"&gt;dropindexes &lt;/span&gt;&lt;span style="color: blue"&gt;CURSOR FOR         &lt;br /&gt;          &lt;br /&gt;SELECT &lt;/span&gt;&lt;span style="color: black"&gt;sysindexes.name&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;sysobjects.name&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;sysusers.name         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;&lt;span style="color: black"&gt;sysindexes         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;JOIN &lt;/span&gt;&lt;span style="color: black"&gt;sysobjects &lt;/span&gt;&lt;span style="color: blue"&gt;ON &lt;/span&gt;&lt;span style="color: black"&gt;sysindexes.id &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;sysobjects.id         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;JOIN &lt;/span&gt;&lt;span style="color: black"&gt;sysusers &lt;/span&gt;&lt;span style="color: blue"&gt;ON &lt;/span&gt;&lt;span style="color: black"&gt;sysobjects.uid &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;sysusers.uid         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;WHERE &lt;/span&gt;&lt;span style="color: black"&gt;indid &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;gt; &lt;/span&gt;&lt;span style="color: black"&gt;0          &lt;br /&gt;&amp;#160; &lt;/span&gt;&lt;span style="color: gray"&gt;AND &lt;/span&gt;&lt;span style="color: black"&gt;indid &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt; &lt;/span&gt;&lt;span style="color: black"&gt;255          &lt;br /&gt;&amp;#160; &lt;/span&gt;&lt;span style="color: gray"&gt;AND &lt;/span&gt;&lt;span style="color: magenta"&gt;INDEXPROPERTY&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;sysobjects.id&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;sysindexes.name&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: red"&gt;'IsStatistics'&lt;/span&gt;&lt;span style="color: gray"&gt;) &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;0         &lt;br /&gt;&amp;#160; &lt;/span&gt;&lt;span style="color: gray"&gt;AND &lt;/span&gt;&lt;span style="color: black"&gt;sysobjects.&lt;/span&gt;&lt;span style="color: blue"&gt;TYPE = &lt;/span&gt;&lt;span style="color: red"&gt;N'U'         &lt;br /&gt;&amp;#160; &lt;/span&gt;&lt;span style="color: gray"&gt;AND NOT EXISTS (&lt;/span&gt;&lt;span style="color: blue"&gt;SELECT &lt;/span&gt;&lt;span style="color: black"&gt;1 &lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;&lt;span style="color: black"&gt;sysobjects &lt;/span&gt;&lt;span style="color: blue"&gt;WHERE &lt;/span&gt;&lt;span style="color: black"&gt;sysobjects.name &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;sysindexes.name&lt;/span&gt;&lt;span style="color: gray"&gt;)         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;ORDER BY &lt;/span&gt;&lt;span style="color: black"&gt;sysindexes.id&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;indid &lt;/span&gt;&lt;span style="color: blue"&gt;DESC         &lt;br /&gt;          &lt;br /&gt;OPEN &lt;/span&gt;&lt;span style="color: black"&gt;dropindexes         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;FETCH &lt;/span&gt;&lt;span style="color: black"&gt;NEXT &lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;&lt;span style="color: black"&gt;dropindexes &lt;/span&gt;&lt;span style="color: blue"&gt;INTO &lt;/span&gt;&lt;span style="color: #434343"&gt;@indexname&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: #434343"&gt;@tablename&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: #434343"&gt;@ownername         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;WHILE &lt;/span&gt;&lt;span style="color: #434343"&gt;@@fetch_status &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;0         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;BEGIN         &lt;br /&gt;&amp;#160; SET &lt;/span&gt;&lt;span style="color: #434343"&gt;@sql &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: red"&gt;N'DROP INDEX '&lt;/span&gt;&lt;span style="color: gray"&gt;+&lt;/span&gt;&lt;span style="color: magenta"&gt;QUOTENAME&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: #434343"&gt;@ownername&lt;/span&gt;&lt;span style="color: gray"&gt;)+&lt;/span&gt;&lt;span style="color: red"&gt;'.'&lt;/span&gt;&lt;span style="color: gray"&gt;+&lt;/span&gt;&lt;span style="color: magenta"&gt;QUOTENAME&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: #434343"&gt;@tablename&lt;/span&gt;&lt;span style="color: gray"&gt;)+&lt;/span&gt;&lt;span style="color: red"&gt;'.'&lt;/span&gt;&lt;span style="color: gray"&gt;+&lt;/span&gt;&lt;span style="color: magenta"&gt;QUOTENAME&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: #434343"&gt;@indexname&lt;/span&gt;&lt;span style="color: gray"&gt;)         &lt;br /&gt;&amp;#160; &lt;/span&gt;&lt;span style="color: blue"&gt;PRINT &lt;/span&gt;&lt;span style="color: #434343"&gt;@sql         &lt;br /&gt;&amp;#160; &lt;/span&gt;&lt;span style="color: blue"&gt;EXEC &lt;/span&gt;&lt;span style="color: darkred"&gt;sp_executesql &lt;/span&gt;&lt;span style="color: #434343"&gt;@sql&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160; &lt;/span&gt;&lt;span style="color: blue"&gt;FETCH &lt;/span&gt;&lt;span style="color: black"&gt;NEXT &lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;&lt;span style="color: black"&gt;dropindexes &lt;/span&gt;&lt;span style="color: blue"&gt;INTO &lt;/span&gt;&lt;span style="color: #434343"&gt;@indexname&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: #434343"&gt;@tablename&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: #434343"&gt;@ownername         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;END         &lt;br /&gt;CLOSE &lt;/span&gt;&lt;span style="color: black"&gt;dropindexes         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;DEALLOCATE &lt;/span&gt;&lt;span style="color: black"&gt;dropindexes         &lt;br /&gt;          &lt;br /&gt;GO          &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;DECLARE &lt;/span&gt;&lt;span style="color: #434343"&gt;@ownername &lt;/span&gt;&lt;span style="color: blue"&gt;SYSNAME         &lt;br /&gt;DECLARE &lt;/span&gt;&lt;span style="color: #434343"&gt;@tablename &lt;/span&gt;&lt;span style="color: blue"&gt;SYSNAME         &lt;br /&gt;DECLARE &lt;/span&gt;&lt;span style="color: #434343"&gt;@statsname &lt;/span&gt;&lt;span style="color: blue"&gt;SYSNAME         &lt;br /&gt;DECLARE &lt;/span&gt;&lt;span style="color: #434343"&gt;@sql &lt;/span&gt;&lt;span style="color: blue"&gt;NVARCHAR&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;4000&lt;/span&gt;&lt;span style="color: gray"&gt;)         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;DECLARE &lt;/span&gt;&lt;span style="color: black"&gt;dropstats &lt;/span&gt;&lt;span style="color: blue"&gt;CURSOR FOR         &lt;br /&gt;          &lt;br /&gt;SELECT &lt;/span&gt;&lt;span style="color: black"&gt;sysindexes.name&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;sysobjects.name&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;sysusers.name          &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;&lt;span style="color: black"&gt;sysindexes         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;JOIN &lt;/span&gt;&lt;span style="color: black"&gt;sysobjects &lt;/span&gt;&lt;span style="color: blue"&gt;ON &lt;/span&gt;&lt;span style="color: black"&gt;sysindexes.id &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;sysobjects.id         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;JOIN &lt;/span&gt;&lt;span style="color: black"&gt;sysusers &lt;/span&gt;&lt;span style="color: blue"&gt;ON &lt;/span&gt;&lt;span style="color: black"&gt;sysobjects.uid &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;sysusers.uid         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;WHERE &lt;/span&gt;&lt;span style="color: black"&gt;indid &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;gt; &lt;/span&gt;&lt;span style="color: black"&gt;0          &lt;br /&gt;&amp;#160; &lt;/span&gt;&lt;span style="color: gray"&gt;AND &lt;/span&gt;&lt;span style="color: black"&gt;indid &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt; &lt;/span&gt;&lt;span style="color: black"&gt;255          &lt;br /&gt;&amp;#160; &lt;/span&gt;&lt;span style="color: gray"&gt;AND &lt;/span&gt;&lt;span style="color: magenta"&gt;INDEXPROPERTY&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;sysobjects.id&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;sysindexes.name&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: red"&gt;'IsStatistics'&lt;/span&gt;&lt;span style="color: gray"&gt;) &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;1         &lt;br /&gt;&amp;#160; &lt;/span&gt;&lt;span style="color: gray"&gt;AND &lt;/span&gt;&lt;span style="color: black"&gt;sysobjects.&lt;/span&gt;&lt;span style="color: blue"&gt;TYPE = &lt;/span&gt;&lt;span style="color: red"&gt;N'U'&lt;/span&gt;&lt;span style="color: gray"&gt;;         &lt;br /&gt;          &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;OPEN &lt;/span&gt;&lt;span style="color: black"&gt;dropstats         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;FETCH &lt;/span&gt;&lt;span style="color: black"&gt;NEXT &lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;&lt;span style="color: black"&gt;dropstats &lt;/span&gt;&lt;span style="color: blue"&gt;INTO &lt;/span&gt;&lt;span style="color: #434343"&gt;@statsname&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: #434343"&gt;@tablename&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: #434343"&gt;@ownername         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;WHILE &lt;/span&gt;&lt;span style="color: #434343"&gt;@@fetch_status &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;0         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;BEGIN         &lt;br /&gt;&amp;#160; SET &lt;/span&gt;&lt;span style="color: #434343"&gt;@sql &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: red"&gt;N'DROP STATISTICS '&lt;/span&gt;&lt;span style="color: gray"&gt;+&lt;/span&gt;&lt;span style="color: magenta"&gt;QUOTENAME&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: #434343"&gt;@ownername&lt;/span&gt;&lt;span style="color: gray"&gt;)+&lt;/span&gt;&lt;span style="color: red"&gt;'.'&lt;/span&gt;&lt;span style="color: gray"&gt;+&lt;/span&gt;&lt;span style="color: magenta"&gt;QUOTENAME&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: #434343"&gt;@tablename&lt;/span&gt;&lt;span style="color: gray"&gt;)+&lt;/span&gt;&lt;span style="color: red"&gt;'.'&lt;/span&gt;&lt;span style="color: gray"&gt;+&lt;/span&gt;&lt;span style="color: magenta"&gt;QUOTENAME&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: #434343"&gt;@statsname&lt;/span&gt;&lt;span style="color: gray"&gt;)         &lt;br /&gt;&amp;#160; &lt;/span&gt;&lt;span style="color: blue"&gt;EXEC &lt;/span&gt;&lt;span style="color: darkred"&gt;sp_executesql &lt;/span&gt;&lt;span style="color: #434343"&gt;@sql&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160; &lt;/span&gt;&lt;span style="color: green"&gt;--PRINT @sql         &lt;br /&gt;&amp;#160; &lt;/span&gt;&lt;span style="color: blue"&gt;FETCH &lt;/span&gt;&lt;span style="color: black"&gt;NEXT &lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;&lt;span style="color: black"&gt;dropstats &lt;/span&gt;&lt;span style="color: blue"&gt;INTO &lt;/span&gt;&lt;span style="color: #434343"&gt;@statsname&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: #434343"&gt;@tablename&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: #434343"&gt;@ownername         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;END         &lt;br /&gt;CLOSE &lt;/span&gt;&lt;span style="color: black"&gt;dropstats         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;DEALLOCATE &lt;/span&gt;&lt;span style="color: black"&gt;dropstats         &lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;The above script will work for SQL 2005 and 2008 also, but only because compatibility views have been carried forward in code by Microsoft. The correct code for doing this in SQL 2005 and 2008 is as follows:    &lt;br /&gt;    &lt;br /&gt;&lt;strong&gt;SQL Server 2005/2008&lt;/strong&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;code style="font-size: 12px"&gt;&lt;span style="color: blue"&gt;DECLARE &lt;/span&gt;&lt;span style="color: #434343"&gt;@ownername &lt;/span&gt;&lt;span style="color: blue"&gt;SYSNAME         &lt;br /&gt;DECLARE &lt;/span&gt;&lt;span style="color: #434343"&gt;@tablename &lt;/span&gt;&lt;span style="color: blue"&gt;SYSNAME         &lt;br /&gt;DECLARE &lt;/span&gt;&lt;span style="color: #434343"&gt;@indexname &lt;/span&gt;&lt;span style="color: blue"&gt;SYSNAME         &lt;br /&gt;DECLARE &lt;/span&gt;&lt;span style="color: #434343"&gt;@sql &lt;/span&gt;&lt;span style="color: blue"&gt;NVARCHAR&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;4000&lt;/span&gt;&lt;span style="color: gray"&gt;)         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;DECLARE &lt;/span&gt;&lt;span style="color: black"&gt;dropindexes &lt;/span&gt;&lt;span style="color: blue"&gt;CURSOR FOR         &lt;br /&gt;          &lt;br /&gt;SELECT &lt;/span&gt;&lt;span style="color: black"&gt;indexes.name&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;objects.name&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;schemas.name         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;&lt;span style="color: black"&gt;sys.indexes         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;JOIN &lt;/span&gt;&lt;span style="color: black"&gt;sys.objects &lt;/span&gt;&lt;span style="color: blue"&gt;ON &lt;/span&gt;&lt;span style="color: black"&gt;indexes.&lt;/span&gt;&lt;span style="color: magenta"&gt;OBJECT_ID &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;objects.&lt;/span&gt;&lt;span style="color: magenta"&gt;OBJECT_ID         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;JOIN &lt;/span&gt;&lt;span style="color: black"&gt;sys.schemas &lt;/span&gt;&lt;span style="color: blue"&gt;ON &lt;/span&gt;&lt;span style="color: black"&gt;objects.schema_id &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;schemas.schema_id         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;WHERE &lt;/span&gt;&lt;span style="color: black"&gt;indexes.index_id &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;gt; &lt;/span&gt;&lt;span style="color: black"&gt;0          &lt;br /&gt;&amp;#160; &lt;/span&gt;&lt;span style="color: gray"&gt;AND &lt;/span&gt;&lt;span style="color: black"&gt;indexes.index_id &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt; &lt;/span&gt;&lt;span style="color: black"&gt;255          &lt;br /&gt;&amp;#160; &lt;/span&gt;&lt;span style="color: gray"&gt;AND &lt;/span&gt;&lt;span style="color: black"&gt;objects.is_ms_shipped &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;0         &lt;br /&gt;&amp;#160; &lt;/span&gt;&lt;span style="color: gray"&gt;AND NOT EXISTS (&lt;/span&gt;&lt;span style="color: blue"&gt;SELECT &lt;/span&gt;&lt;span style="color: black"&gt;1 &lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;&lt;span style="color: black"&gt;sys.objects &lt;/span&gt;&lt;span style="color: blue"&gt;WHERE &lt;/span&gt;&lt;span style="color: black"&gt;objects.name &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;indexes.name&lt;/span&gt;&lt;span style="color: gray"&gt;)         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;ORDER BY &lt;/span&gt;&lt;span style="color: black"&gt;objects.&lt;/span&gt;&lt;span style="color: magenta"&gt;OBJECT_ID&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;indexes.index_id &lt;/span&gt;&lt;span style="color: blue"&gt;DESC         &lt;br /&gt;          &lt;br /&gt;          &lt;br /&gt;SELECT &lt;/span&gt;&lt;span style="color: gray"&gt;* &lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;&lt;span style="color: black"&gt;sys.stats         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;OPEN &lt;/span&gt;&lt;span style="color: black"&gt;dropindexes         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;FETCH &lt;/span&gt;&lt;span style="color: black"&gt;NEXT &lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;&lt;span style="color: black"&gt;dropindexes &lt;/span&gt;&lt;span style="color: blue"&gt;INTO &lt;/span&gt;&lt;span style="color: #434343"&gt;@indexname&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: #434343"&gt;@tablename&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: #434343"&gt;@ownername         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;WHILE &lt;/span&gt;&lt;span style="color: #434343"&gt;@@fetch_status &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;0         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;BEGIN         &lt;br /&gt;&amp;#160; SET &lt;/span&gt;&lt;span style="color: #434343"&gt;@sql &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: red"&gt;N'DROP INDEX '&lt;/span&gt;&lt;span style="color: gray"&gt;+&lt;/span&gt;&lt;span style="color: magenta"&gt;QUOTENAME&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: #434343"&gt;@ownername&lt;/span&gt;&lt;span style="color: gray"&gt;)+&lt;/span&gt;&lt;span style="color: red"&gt;'.'&lt;/span&gt;&lt;span style="color: gray"&gt;+&lt;/span&gt;&lt;span style="color: magenta"&gt;QUOTENAME&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: #434343"&gt;@tablename&lt;/span&gt;&lt;span style="color: gray"&gt;)+&lt;/span&gt;&lt;span style="color: red"&gt;'.'&lt;/span&gt;&lt;span style="color: gray"&gt;+&lt;/span&gt;&lt;span style="color: magenta"&gt;QUOTENAME&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: #434343"&gt;@indexname&lt;/span&gt;&lt;span style="color: gray"&gt;)         &lt;br /&gt;&amp;#160; &lt;/span&gt;&lt;span style="color: blue"&gt;PRINT &lt;/span&gt;&lt;span style="color: #434343"&gt;@sql         &lt;br /&gt;&amp;#160; &lt;/span&gt;&lt;span style="color: blue"&gt;EXEC &lt;/span&gt;&lt;span style="color: darkred"&gt;sp_executesql &lt;/span&gt;&lt;span style="color: #434343"&gt;@sql&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160; &lt;/span&gt;&lt;span style="color: blue"&gt;FETCH &lt;/span&gt;&lt;span style="color: black"&gt;NEXT &lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;&lt;span style="color: black"&gt;dropindexes &lt;/span&gt;&lt;span style="color: blue"&gt;INTO &lt;/span&gt;&lt;span style="color: #434343"&gt;@indexname&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: #434343"&gt;@tablename&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: #434343"&gt;@ownername         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;END         &lt;br /&gt;CLOSE &lt;/span&gt;&lt;span style="color: black"&gt;dropindexes         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;DEALLOCATE &lt;/span&gt;&lt;span style="color: black"&gt;dropindexes         &lt;br /&gt;          &lt;br /&gt;GO          &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;DECLARE &lt;/span&gt;&lt;span style="color: #434343"&gt;@ownername &lt;/span&gt;&lt;span style="color: blue"&gt;SYSNAME         &lt;br /&gt;DECLARE &lt;/span&gt;&lt;span style="color: #434343"&gt;@tablename &lt;/span&gt;&lt;span style="color: blue"&gt;SYSNAME         &lt;br /&gt;DECLARE &lt;/span&gt;&lt;span style="color: #434343"&gt;@statsname &lt;/span&gt;&lt;span style="color: blue"&gt;SYSNAME         &lt;br /&gt;DECLARE &lt;/span&gt;&lt;span style="color: #434343"&gt;@sql &lt;/span&gt;&lt;span style="color: blue"&gt;NVARCHAR&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;4000&lt;/span&gt;&lt;span style="color: gray"&gt;)         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;DECLARE &lt;/span&gt;&lt;span style="color: black"&gt;dropstats &lt;/span&gt;&lt;span style="color: blue"&gt;CURSOR FOR         &lt;br /&gt;          &lt;br /&gt;SELECT &lt;/span&gt;&lt;span style="color: black"&gt;stats.name&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;objects.name&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;schemas.name         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;&lt;span style="color: black"&gt;sys.stats         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;JOIN &lt;/span&gt;&lt;span style="color: black"&gt;sys.objects &lt;/span&gt;&lt;span style="color: blue"&gt;ON &lt;/span&gt;&lt;span style="color: black"&gt;stats.&lt;/span&gt;&lt;span style="color: magenta"&gt;OBJECT_ID &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;objects.&lt;/span&gt;&lt;span style="color: magenta"&gt;OBJECT_ID         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;JOIN &lt;/span&gt;&lt;span style="color: black"&gt;sys.schemas &lt;/span&gt;&lt;span style="color: blue"&gt;ON &lt;/span&gt;&lt;span style="color: black"&gt;objects.schema_id &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;schemas.schema_id         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;WHERE &lt;/span&gt;&lt;span style="color: black"&gt;stats.stats_id &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;gt; &lt;/span&gt;&lt;span style="color: black"&gt;0          &lt;br /&gt;&amp;#160; &lt;/span&gt;&lt;span style="color: gray"&gt;AND &lt;/span&gt;&lt;span style="color: black"&gt;stats.stats_id &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt; &lt;/span&gt;&lt;span style="color: black"&gt;255          &lt;br /&gt;&amp;#160; &lt;/span&gt;&lt;span style="color: gray"&gt;AND &lt;/span&gt;&lt;span style="color: black"&gt;objects.is_ms_shipped &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;0         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;ORDER BY &lt;/span&gt;&lt;span style="color: black"&gt;objects.&lt;/span&gt;&lt;span style="color: magenta"&gt;OBJECT_ID&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;stats.stats_id &lt;/span&gt;&lt;span style="color: blue"&gt;DESC         &lt;br /&gt;          &lt;br /&gt;OPEN &lt;/span&gt;&lt;span style="color: black"&gt;dropstats         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;FETCH &lt;/span&gt;&lt;span style="color: black"&gt;NEXT &lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;&lt;span style="color: black"&gt;dropstats &lt;/span&gt;&lt;span style="color: blue"&gt;INTO &lt;/span&gt;&lt;span style="color: #434343"&gt;@statsname&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: #434343"&gt;@tablename&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: #434343"&gt;@ownername         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;WHILE &lt;/span&gt;&lt;span style="color: #434343"&gt;@@fetch_status &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;0         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;BEGIN         &lt;br /&gt;&amp;#160; SET &lt;/span&gt;&lt;span style="color: #434343"&gt;@sql &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: red"&gt;N'DROP STATISTICS '&lt;/span&gt;&lt;span style="color: gray"&gt;+&lt;/span&gt;&lt;span style="color: magenta"&gt;QUOTENAME&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: #434343"&gt;@ownername&lt;/span&gt;&lt;span style="color: gray"&gt;)+&lt;/span&gt;&lt;span style="color: red"&gt;'.'&lt;/span&gt;&lt;span style="color: gray"&gt;+&lt;/span&gt;&lt;span style="color: magenta"&gt;QUOTENAME&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: #434343"&gt;@tablename&lt;/span&gt;&lt;span style="color: gray"&gt;)+&lt;/span&gt;&lt;span style="color: red"&gt;'.'&lt;/span&gt;&lt;span style="color: gray"&gt;+&lt;/span&gt;&lt;span style="color: magenta"&gt;QUOTENAME&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: #434343"&gt;@statsname&lt;/span&gt;&lt;span style="color: gray"&gt;)         &lt;br /&gt;&amp;#160; &lt;/span&gt;&lt;span style="color: blue"&gt;EXEC &lt;/span&gt;&lt;span style="color: darkred"&gt;sp_executesql &lt;/span&gt;&lt;span style="color: #434343"&gt;@sql&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160; &lt;/span&gt;&lt;span style="color: green"&gt;--PRINT @sql         &lt;br /&gt;&amp;#160; &lt;/span&gt;&lt;span style="color: blue"&gt;FETCH &lt;/span&gt;&lt;span style="color: black"&gt;NEXT &lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;&lt;span style="color: black"&gt;dropstats &lt;/span&gt;&lt;span style="color: blue"&gt;INTO &lt;/span&gt;&lt;span style="color: #434343"&gt;@statsname&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: #434343"&gt;@tablename&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: #434343"&gt;@ownername         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;END         &lt;br /&gt;CLOSE &lt;/span&gt;&lt;span style="color: black"&gt;dropstats         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;DEALLOCATE &lt;/span&gt;&lt;span style="color: black"&gt;dropstats         &lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Hope it helps someone out.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-3160792751035309309?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/3160792751035309309/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/drop-all-indexes-and-stats-in-one.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/3160792751035309309'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/3160792751035309309'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/drop-all-indexes-and-stats-in-one.html' title='Drop All Indexes and Stats in one Script'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-8749964956041541291</id><published>2008-12-11T07:02:00.000-05:00</published><updated>2008-12-11T07:02:00.724-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSMS'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='Miscellaneous'/><title type='text'>SQL Server Management Studio Object Explorer Autohide Delay</title><content type='html'>&lt;p&gt;One of the most popular pages on my blog for some reason is the &lt;a href="http://jmkehayias.blogspot.com/2008/07/setting-auto-recoveryautosave-in-sql.html"&gt;Setting Auto-Recovery/AutoSave in SQL Server Management Studio&lt;/a&gt; post I made back in July.&amp;#160; I don't usually recommend that someone hack their registry manually, but in some cases it is the only way to make the changes because the tools available in the application don't allow for it.&amp;#160; SQL Server Management Studio is one of those applications whose configuration options in the registry are not adequately exposed in the tools or options menus.&lt;/p&gt;  &lt;p&gt;Since that little hack was so popular, I figured I would post another one, but first the needed warnings:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt;DISCLAIMER:&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt;Editing the registry is not generally recommended, and/or supported.&amp;#160; If you choose to do so, you are doing it at your own risk.&amp;#160; I am not responsible for damage caused by you editing the registry manually.&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Coming once again from the MSDN Forums, this hack involves changing the speed with which the Object Explorer auto hide occurs.&amp;#160; A &lt;a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=4011261&amp;amp;SiteID=1"&gt;post back in October&lt;/a&gt; commented that the delay for the autohide was to long in SQL Server Management Studio, and wanted to know how to change the time it took to be faster.&amp;#160; Of course this is not documented anywhere online, so I went back to my July post, and started looking at the various registry keys that were available for Management Studio in one of my VPC's.&amp;#160; What I found is the following:&lt;/p&gt;  &lt;p&gt;You can edit the following Registry Key:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Server\90\Tools\Shell\General\AnimationSpeed&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;The higher the value, the faster it will close.&amp;#160; At Hex value 20 it is almost immediately closed.&lt;/p&gt;  &lt;p&gt;You can disable the Animations completely by changing:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Server\90\Tools\Shell\General\Animations&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;and setting it to a value of 0.&lt;/p&gt;  &lt;p&gt;If it helps you out, cool, but if you break it, don't email any scathing comments to me about editing your registry manually.&amp;#160; I am only going to refer you back to the Disclaimer above.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-8749964956041541291?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/8749964956041541291/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/sql-server-management-studio-object.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/8749964956041541291'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/8749964956041541291'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/sql-server-management-studio-object.html' title='SQL Server Management Studio Object Explorer Autohide Delay'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-8736066296927815067</id><published>2008-12-11T00:03:00.001-05:00</published><updated>2008-12-11T00:03:58.442-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Certification'/><title type='text'>Passed MCITP - 2008 Database Developer</title><content type='html'>&lt;p&gt;A while back I posted about Beta Exams for SQL Server 2008 where Microsoft basically paid your way to take the certification exams for SQL Server 2008.&amp;#160; The trade off was, you needed to provide feedback on the exam material to help them better create the final questions.&amp;#160; Back in October I was invited by Microsoft to fly to Redmond and sit in a round table discussion on one of the exams I took to review the questions but responsibilities of life simply got in the way of that.&amp;#160; To bad, because it gave me a chance to meet and greet some people I know online, where I might not have been able to otherwise.&lt;/p&gt;  &lt;p&gt;Tonight I got an email letting me know that I had passed both the MCTS and MCITP 2008 Database Developer Examinations (if only I had known about the beta exams when the Admin ones were out).&amp;#160; Now all I have left is my MCITP 2008 Administrator Exam since I passed the MCTS at PASS Summit.&amp;#160; Should be able to knock that one out in January sometime.&amp;#160; Professionally, it doesn't mean a whole lot to me as certifications are not a requirement in my current position, but personally it is a great validation that for all the hours I put in playing with the CTP's and RC0, that I actually learned something.&lt;/p&gt;  &lt;p&gt;My take on the exams?&amp;#160; Well if you really know your stuff on SQL Server 2005, the gap isn't very big to 2008.&amp;#160; If you are still on SQL Server 2000, you have a lot of catching up to do.&amp;#160; SQL Server 2008 brings a number of new things into the mix, Grouping Sets, XML enhancements, Geography datatype, Geometry datatype, HierarchyID, sparse columns, filtered indexes, Policy Based Management, Performance Data Warehouse and the Data Collectors, and Extended Events to name a few.&amp;#160; However, learning the fundamentals of these new items is far easier than learning the additions to SQL Server 2005 plus the additions to SQL Server 2008.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-8736066296927815067?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/8736066296927815067/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/passed-mcitp-2008-database-developer.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/8736066296927815067'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/8736066296927815067'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/passed-mcitp-2008-database-developer.html' title='Passed MCITP - 2008 Database Developer'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-4577410647960899873</id><published>2008-12-10T06:49:00.000-05:00</published><updated>2008-12-10T06:49:00.263-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DBA Tutorials'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='Blocking'/><title type='text'>Troubleshooting locking in the database with DMV's</title><content type='html'>&lt;p&gt;Anyone following my blog knows full well that most of my blog posts come from the MSDN Forums. So it should be no surprise to you if you follow my blog, that this one is yet again &lt;a href="http://forums.microsoft.com/Forums/ShowPost.aspx?PostID=4214330&amp;amp;SiteID=1&amp;amp;mode=1"&gt;another question from the forums.&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;This one deals with locking in the database engine and how to identify what the index and object names are for locks that are taken and reported in sys.dm_tran_locks.&amp;#160; The resource_type column in this DMV provides information about what lock is taken, and for PAGE and RID types the resource_description column will have a page identifier like 1:2453977.&amp;#160; However for KEY types, the resource_description is a somewhat &amp;quot;cryptic&amp;quot; value like (52004e8d59a4).&amp;#160; &lt;/p&gt;  &lt;p&gt;The question posed was how to get the index/objectid from this value.&amp;#160; The answer is simply, you don't/can't.&amp;#160; The assumption that the resource_description column is the key to the object is wrong.&amp;#160; The actual key to the object is the resource_associated_entity_id which is the sys.partitions DMV's hobt_id.&amp;#160; By joining these two views together, it is very easy to get back to the index and object since the sys.partitions DMV carries the object_id and index_id for the allocation unit being locked.&amp;#160; The following query demonstrates how to get the information details for a lock out of the storage engine:&lt;/p&gt;  &lt;p&gt;&lt;code style="font-size: 12px"&gt;&lt;span style="color: blue"&gt;SELECT &lt;/span&gt;&lt;span style="color: black"&gt;dm_tran_locks.request_session_id&lt;/span&gt;&lt;span style="color: gray"&gt;,        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: black"&gt;dm_tran_locks.resource_database_id&lt;/span&gt;&lt;span style="color: gray"&gt;,        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: magenta"&gt;DB_NAME&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;dm_tran_locks.resource_database_id&lt;/span&gt;&lt;span style="color: gray"&gt;) &lt;/span&gt;&lt;span style="color: blue"&gt;AS &lt;/span&gt;&lt;span style="color: black"&gt;dbname&lt;/span&gt;&lt;span style="color: gray"&gt;,        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: magenta"&gt;CASE        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: blue"&gt;WHEN &lt;/span&gt;&lt;span style="color: black"&gt;resource_type &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: red"&gt;'object'        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: blue"&gt;THEN &lt;/span&gt;&lt;span style="color: magenta"&gt;OBJECT_NAME&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;dm_tran_locks.resource_associated_entity_id&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: blue"&gt;ELSE &lt;/span&gt;&lt;span style="color: magenta"&gt;OBJECT_NAME&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;partitions.&lt;/span&gt;&lt;span style="color: magenta"&gt;OBJECT_ID&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: blue"&gt;END AS &lt;/span&gt;&lt;span style="color: black"&gt;ObjectName&lt;/span&gt;&lt;span style="color: gray"&gt;,        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: black"&gt;partitions.index_id&lt;/span&gt;&lt;span style="color: gray"&gt;,        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: black"&gt;indexes.name &lt;/span&gt;&lt;span style="color: blue"&gt;AS &lt;/span&gt;&lt;span style="color: black"&gt;index_name&lt;/span&gt;&lt;span style="color: gray"&gt;,        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: black"&gt;dm_tran_locks.resource_type&lt;/span&gt;&lt;span style="color: gray"&gt;,        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: black"&gt;dm_tran_locks.resource_description&lt;/span&gt;&lt;span style="color: gray"&gt;,        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: black"&gt;dm_tran_locks.resource_associated_entity_id&lt;/span&gt;&lt;span style="color: gray"&gt;,        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: black"&gt;dm_tran_locks.request_mode&lt;/span&gt;&lt;span style="color: gray"&gt;,        &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: black"&gt;dm_tran_locks.request_status        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;&lt;span style="color: black"&gt;sys.dm_tran_locks        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: magenta"&gt;LEFT &lt;/span&gt;&lt;span style="color: blue"&gt;JOIN &lt;/span&gt;&lt;span style="color: black"&gt;sys.partitions &lt;/span&gt;&lt;span style="color: blue"&gt;ON &lt;/span&gt;&lt;span style="color: black"&gt;partitions.hobt_id &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;dm_tran_locks.resource_associated_entity_id        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;JOIN &lt;/span&gt;&lt;span style="color: black"&gt;sys.indexes &lt;/span&gt;&lt;span style="color: blue"&gt;ON &lt;/span&gt;&lt;span style="color: black"&gt;indexes.&lt;/span&gt;&lt;span style="color: magenta"&gt;OBJECT_ID &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;partitions.&lt;/span&gt;&lt;span style="color: magenta"&gt;OBJECT_ID &lt;/span&gt;&lt;span style="color: gray"&gt;AND &lt;/span&gt;&lt;span style="color: black"&gt;indexes.index_id &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;partitions.index_id        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;WHERE &lt;/span&gt;&lt;span style="color: black"&gt;resource_associated_entity_id &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;gt; &lt;/span&gt;&lt;span style="color: black"&gt;0        &lt;br /&gt;&amp;#160; &lt;/span&gt;&lt;span style="color: gray"&gt;AND &lt;/span&gt;&lt;span style="color: black"&gt;resource_database_id &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: magenta"&gt;DB_ID&lt;/span&gt;&lt;span style="color: gray"&gt;()        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;ORDER BY &lt;/span&gt;&lt;span style="color: black"&gt;request_session_id&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;resource_associated_entity_id        &lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;  &lt;p&gt;In researching this question, I actually learned a good bit more about object identification in SQL Server 2005 and 2008.&amp;#160; The sys.partitions table is actually a key table in deadlock analysis as well, which I will blog about in another entry, since deadlocks are one of my favorite subjects to &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-4577410647960899873?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/4577410647960899873/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/troubleshooting-locking-in-database.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/4577410647960899873'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/4577410647960899873'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/troubleshooting-locking-in-database.html' title='Troubleshooting locking in the database with DMV&amp;#39;s'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-1406517367220618168</id><published>2008-12-09T23:54:00.003-05:00</published><updated>2009-02-17T02:07:52.381-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Miscellaneous'/><title type='text'>SQL Quiz #1</title><content type='html'>&lt;p&gt;This post has been migrated to my new blog on SQLBlog.com. You can find this post at the following address:&lt;/p&gt;&lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jonathan_kehayias/archive/2008/12/09/sql-quiz-1.aspx"&gt;http://sqlblog.com/blogs/jonathan_kehayias/archive/2008/12/09/sql-quiz-1.aspx&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-1406517367220618168?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/1406517367220618168/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/sql-quiz-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/1406517367220618168'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/1406517367220618168'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/sql-quiz-1.html' title='SQL Quiz #1'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-7308092810258422781</id><published>2008-12-09T20:04:00.001-05:00</published><updated>2008-12-09T20:04:05.937-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Miscellaneous'/><title type='text'>SQL Quiz Part 2</title><content type='html'>&lt;p&gt;In early November &lt;a href="http://chrisshaw.wordpress.com/" target="_blank"&gt;Chris Shaw&lt;/a&gt; started a chain blog of sorts called &lt;a href="http://chrisshaw.wordpress.com/2008/11/05/new-sql-quiz/" target="_blank"&gt;SQL Quiz&lt;/a&gt; where he called out two well known members of the SQL Community &lt;a href="http://www.brentozar.com/"&gt;Brent Ozar&lt;/a&gt; and &lt;a href="http://statisticsio.com/"&gt;Jason Massie&lt;/a&gt; to post about their two biggest mistakes as SQL Server DBA's.&amp;#160; I subscribe to both of their blog feeds and thought it was interesting to read about other peoples mistakes.&amp;#160; Chris's intent was to create a chain of posts from well known people in the SQL Community that the community could learn from.&amp;#160; The chain circled around a fairly large group of people including &lt;a href="http://sqlbatman.com"&gt;SQLBatman&lt;/a&gt;.&amp;#160; It did not however, include me, which I was just fine with.&lt;/p&gt;  &lt;p&gt;Well our would be phantom of the night decided to call me out on Chris Shaw's new &lt;a href="http://chrisshaw.wordpress.com/2008/12/09/sql-quiz-part-2-2/" target="_blank"&gt;SQL Quiz Part 2.&lt;/a&gt;&amp;#160; The Questions for this quiz&amp;#8230;What are the largest challenges that you have faced in your career and how did you overcome those?&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Here are my answers...&lt;/strong&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;The largest challenge I have faced in my career has to be making the decision to leave a stable job where I wasn't being allowed to progress in my career as I wanted to, and find another job. I tend to be a very loyal person, almost to a fault.&amp;#160; I stick it out with through thick and thin, and dedicate myself 100% to anything that I do.&amp;#160; I can always find the half full side of the glass, though it may not seem like it is there.&amp;#160; When I made the decision to leave my last job, it was at the start of the real estate market decline, and moving jobs also meant moving cities, and having to sell my condo.&amp;#160; &lt;/p&gt;    &lt;p&gt;After contacting a recruiter, I immediately had two great interviews, one with a Christian motivational speaking and marketing company, and one with my current employer OSI Restaurant Partners.&amp;#160; The first company was immediately interested and made an offer on the spot that paid more than the job I was leaving, but the environment felt like the same old same old to me.&amp;#160; OSI on the other hand had a excellent atmosphere, much larger environment, and I would be treading new path as the first SQL DBA they had hired, but they wanted to interview other candidates before deciding anything.&lt;/p&gt;    &lt;p&gt;No real big deal there, I still had my job, and I wasn't really in a rush since I was leaving under my own terms.&amp;#160; Recruiters being what they are, they wanted to close the deal and place me in the first job that presented an offer.&amp;#160; I informed them that I would like to wait until the following Monday and see if OSI had made any decisions yet.&amp;#160; This was on a Wednesday, but I still got a call asking if I had decided about the job offer on Thursday, Friday, and Saturday because the company needed to interview other candidates if I wasn't interested.&amp;#160; Same story every call, same answers from me each time, though I got more and more nervous about my decision with each and every call.&lt;/p&gt;    &lt;p&gt;Monday morning, and yet another call, at which point I decided I wasn't interested in this company, just because I really wanted to know if I could get a job at a major corporation like OSI at this point, so I told the recruiter thanks, but I would wait for an answer from OSI.&amp;#160; Fast forward two hours, and I get a call back again, this time I'm kind of aggravated because I am at work during the day, and all these calls are distracting.&amp;#160; Turns out OSI decided to offer me the job which I immediately accepted and turned in my two weeks notice, which later had to be extended to three weeks so I could complete my current development project.&lt;/p&gt;    &lt;p&gt;A lesson learned from this was not to be wow'd by additional money, and that if you really want something, then you will be willing to wait for it.&amp;#160; It was definitely hard to wait for an offer when I already had one.&amp;#160; Did I happen to mention that my wife kept saying to just take the other job?&amp;#160; I try not to be at odds with my wife, and this caused even more turmoil in the decision process.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;strong&gt;My Second Anecdote:&lt;/strong&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;The second hardest thing I have encountered in my career is actually maintaining balance between being a company man, a family man, a military man, an entrepreneur, and a all around geek.&amp;#160; Most people who know me, and all that I am involved with don't know how I keep up with it all.&amp;#160; Setting priorities, and scheduling things appropriately is one of the greatest challenges I have after 4:30pm everyday (I am at work until 4:30pm).&amp;#160; &lt;/p&gt;    &lt;p&gt;First thing of importance is my family, and I almost always get my daughter from school (daycare) on my way home.&amp;#160; Then it is off to the house to cook dinner before mommy gets home from grad school.&amp;#160; Sometimes we get side tracked and go to the playground or I chase her around the neighborhood on her Barbie Powerwheel and we go feed the ducks.&amp;#160; While dinner cooks, I jump online and catch up on email from the drive home, trust me it stacks up pretty fast sometimes, responses to Newsgroups and forums postings, and new entries in my blog reader.&amp;#160; After dinner is bath time which my wife and I trade off nights for, but my daughters favorite nights are when I put on my swimsuit and play in the tub with her.&amp;#160; Then we do Dora and Diego, book/playtime, and bedtime.&amp;#160; After bedtime is when I usually get to do most of my playing online, consulting/contract work, and learning while my wife studies and works on her papers and homework.&amp;#160; &lt;/p&gt;    &lt;p&gt;Trust me, there is never a dull moment in my life.&amp;#160; One weekend a month I do Army Reserves training, and in 2009, I will be away for 2 months in school for the Army.&amp;#160; The trick for me is, I have fun doing it all.&amp;#160; If it wasn't fun, I wouldn't be doing it.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;As for this SQL Quiz thing, I am not sure that I have actually followed the intent of the challenge, but to me those are the two biggest challenges in my career so far.&lt;/p&gt;  &lt;p&gt;Now I am going to call out &lt;a href="http://kendalvandyke.blogspot.com/" target="_blank"&gt;Kendal Van Dyke&lt;/a&gt; and &lt;a href="http://deepakrangarajan.blogspot.com" target="_blank"&gt;Deepak Ranagarajan.&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-7308092810258422781?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/7308092810258422781/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/sql-quiz-part-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/7308092810258422781'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/7308092810258422781'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/sql-quiz-part-2.html' title='SQL Quiz Part 2'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-3475417667619755938</id><published>2008-12-09T06:31:00.000-05:00</published><updated>2008-12-09T06:31:00.221-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DBA Tutorials'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='Extended Events'/><title type='text'>SQL Server 2008 Extended Events - Reference List</title><content type='html'>&lt;p&gt;One of the best kept secrets of SQL Server 2008 has to be the new Extended Events architecture that was added to the troubleshooting toolset.  The Extended Events Engine is the foundation on which Extended Events provide detailed information from inside the database engine.  I wrote good coverage of Jerome Halmans session at PASS on them for Universal Thread at:&lt;/p&gt;&lt;p&gt;&lt;a title="http://www.utcoverage.com/PASS/2008/" href="http://www.utcoverage.com/PASS/2008/"&gt;http://www.utcoverage.com/PASS/2008/&lt;/a&gt;&lt;/p&gt;&lt;p&gt;However, that only slightly begins to cover the subject.  I spent over a month figuring out Extended Events while working on the Extended Events Manager application that won the SQL Heroes contest.  Back then the information on Extended Events was very limited.  There were &lt;a href="http://jmkehayias.blogspot.com/2008/08/extended-events-and-errors-in-bol.html"&gt;numerous errors&lt;/a&gt; in the Books Online, and only &lt;a href="http://www.sqlskills.com/BLOGS/Bobb"&gt;Bob Beauchemin&lt;/a&gt; had blogged about it. (BTW, I owe a great debt of gratitude to Bob for his willingness to test my app, and provide feedback early on.  He also provided me some excellent recommendations along the way.)&lt;/p&gt;&lt;p&gt;However as time goes on, things change, and good information is fairly readily available on the subject today.  First Paul Randal, recently published an article in Technet Magazine that you can find through his &lt;a href="http://www.sqlskills.com/BLOGS/PAUL/post/TechNet-Magazine-feature-article-on-Advanced-Troubleshooting-with-Extended-Events.aspx"&gt;blog post&lt;/a&gt;.  Then coming in the February/March 2009, the topic will be covered in the &lt;a href="http://www.amazon.com/MicrosoftÂ®-SQL-ServerÂ®-2008-Internals/dp/0735626243/ref=pd_bbs_sr_3?ie=UTF8&amp;amp;s=books&amp;amp;qid=1228792784&amp;amp;sr=8-3"&gt;Microsoft® SQL Server® 2008 Internals (Pro - Developer)&lt;/a&gt; which is available for pre-order now. (Watch for a quick review from me when it actually ships.  I plan to dedicate my time to reading this.)  &lt;/p&gt;&lt;p&gt;Some web references on XEvents (Extended Events) are:&lt;/p&gt;&lt;p&gt;&lt;a href="http://blogs.msdn.com/sqlqueryprocessing/archive/2006/11/12/using-etw-for-sql-server-2005.aspx"&gt;http://blogs.msdn.com/sqlqueryprocessing/archive/2006/11/12/using-etw-for-sql-server-2005.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/bb630354(SQL.100).aspx"&gt;Introducing SQL Server Extended Events&lt;/a&gt;&lt;br /&gt;&lt;a href="http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?culture=en-US&amp;amp;EventID=1032356291&amp;amp;CountryCode=US"&gt;MSDN Webcast: SQL Server 2008 Advanced Troubleshooting with Extended Events (Level 200)&lt;/a&gt;&lt;br /&gt;&lt;a href="http://blogs.technet.com/sqlos/archive/2008/07/18/debugging-slow-response-times-in-sql-server-2008.aspx"&gt;Debugging slow response times in SQL Server 2008&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-3475417667619755938?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/3475417667619755938/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/sql-server-2008-extended-events.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/3475417667619755938'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/3475417667619755938'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/sql-server-2008-extended-events.html' title='SQL Server 2008 Extended Events - Reference List'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-4341552227415721876</id><published>2008-12-08T03:00:00.000-05:00</published><updated>2008-12-08T09:38:41.555-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>SET ROWCOUNT functionality changes</title><content type='html'>&lt;p&gt;Lately it seems to me like I need to put some time and effort into actually reading the updated versions of the Books Online to learn about what I have missed, either as changes coming, or changes that have occured.  Take for instance SET ROWCOUNT.  I learned how to use this in SQL 2000, and it was by someone else, so I have never actually read the BOL entries for it, until recently.  &lt;/p&gt;  &lt;p&gt;If you look back at my first post on the &lt;a href="http://jmkehayias.blogspot.com/2008/11/database-transaction-log-part-1.html"&gt;Transaction Log - Managing Size&lt;/a&gt;, one of the examples I posted for batched deletes uses SET ROWCOUNT to limit the size of the delete batches.  This is actually a commonly posted example on the forums, and other places online, and in answering a question on the Newsgroups, I posted this same example as a response.  Not long after another person on the Newsgroups, &lt;a href="http://pratchev.blogspot.com/"&gt;Plamen Ratchev&lt;/a&gt;, who pointed out that SET ROWCOUNT will cease to function for INSERT, DELETE, and UPDATE in a future release of SQL Server.&lt;/p&gt;  &lt;p&gt;No problem, although this was news to me, so I took a peak at the &lt;a href="http://msdn.microsoft.com/en-us/library/ms188774.aspx"&gt;SQL Server 2008 BOL topic for SET ROWCOUNT&lt;/a&gt; and sure enough it is documented in there:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;Using SET ROWCOUNT will not affect DELETE, INSERT, and UPDATE statements in the next release of SQL Server. Do not use SET ROWCOUNT with DELETE, INSERT, and UPDATE statements in new development work, and plan to modify applications that currently use it. Also, for DELETE, INSERT, and UPDATE statements that currently use SET ROWCOUNT, we recommend that you rewrite them to use the TOP syntax. &lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;So I looked back in time to see where this was introduced, and it actually is listed in the &lt;a href="http://msdn.microsoft.com/en-us/library/aa259189%28SQL.80%29.aspx"&gt;SQL Server 2000 BOL topic&lt;/a&gt; as well.  So it must be being carried forward due to compatibility issues and the amount of code that could be potentially impacted because this really is a common thing to find online or in code.  I did a quick search of the code in some of our vendors databases, and almost every one that does a purge job uses SET ROWCOUNT in them.  Not to worry, I was nice and emailed a few of them that I had contacts with the DBA support/development staff members to let them know about it so they can update it in a future service pack if they choose.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-4341552227415721876?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/4341552227415721876/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/set-rowcount-functionality-changes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/4341552227415721876'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/4341552227415721876'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/set-rowcount-functionality-changes.html' title='SET ROWCOUNT functionality changes'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-5453086067073736025</id><published>2008-12-04T08:43:00.000-05:00</published><updated>2008-12-04T08:43:00.944-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSMS'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA Tutorials'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='Miscellaneous'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Error Messages'/><title type='text'>SQL Server Backup Fundamentals - Mirrored Backup vs Striped Backup</title><content type='html'>&lt;p&gt;SQL Server Backup isn't necessarily the easiest thing in the world to do.&amp;#160; I've seen a few posts recently where the poster is performing a restore operation and encounters the following error message:&lt;/p&gt;  &lt;p&gt;&lt;font color="#ff0000"&gt;TITLE: Microsoft SQL Server Management Studio     &lt;br /&gt;------------------------------&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#ff0000"&gt;Restore failed for Server 'ServerName'.&amp;#160; (Microsoft.SqlServer.Smo)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#ff0000"&gt;For help, click: &lt;/font&gt;&lt;a href="http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&amp;amp;ProdVer=9.00.1399.00&amp;amp;EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&amp;amp;EvtID=Restore+Server&amp;amp;LinkId=20476"&gt;&lt;font color="#ff0000"&gt;http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&amp;amp;ProdVer=9.00.1399.00&amp;amp;EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&amp;amp;EvtID=Restore+Server&amp;amp;LinkId=20476&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#ff0000"&gt;------------------------------     &lt;br /&gt;ADDITIONAL INFORMATION:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#ff0000"&gt;System.Data.SqlClient.SqlError: The media set has 2 media families but only 1 are provided. All members must be provided. (Microsoft.SqlServer.Smo)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#ff0000"&gt;For help, click: &lt;/font&gt;&lt;a href="http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&amp;amp;ProdVer=9.00.1399.00&amp;amp;LinkId=20476"&gt;&lt;font color="#ff0000"&gt;http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&amp;amp;ProdVer=9.00.1399.00&amp;amp;LinkId=20476&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#ff0000"&gt;------------------------------     &lt;br /&gt;BUTTONS:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#ff0000"&gt;OK     &lt;br /&gt;------------------------------&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;What is really sad is that the person encountering this error is often in the midst of a disaster recovery, and unfortunately, they are learning the hard way why testing your backups early, and testing your backups often is a recommended best practice for a reason.&amp;#160; Unfortunately, if you find yourself with this error and this is the only backup of the database you need to restore, you are in serious trouble, because just like a RAID 0 disk, there is no way to rebuild your database without all the backup files in the media set present.&amp;#160; At this point, you might not believe me, and you certainly have that right, but I am presenting the cold hard truth and you can validate this by doing a &lt;a href="http://www.google.com/search?hl=en&amp;amp;q=The+media+set+has+2+media+families+but+only+1+are+provided.+All+members+must+be+provided.+&amp;amp;aq=f&amp;amp;oq=" target="_blank"&gt;Google Search&lt;/a&gt; or a &lt;a href="http://search.live.com/results.aspx?q=The+media+set+has+2+media+families+but+only+1+are+provided.+All+members+must+be+provided.&amp;amp;go=&amp;amp;form=QBRE" target="_blank"&gt;Windows Live Search&lt;/a&gt;.&amp;#160; &lt;/p&gt;  &lt;p&gt;So how exactly does this particular error come about?&amp;#160; For more than a few people it has been caused by SQL Server Management Studio, and confusion about the UI for backing up a database.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_CSUuS5p4wm0/STTLEmpdUPI/AAAAAAAAAFw/bNSK5_zyQfM/image%5B12%5D.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="652" alt="image" src="http://lh5.ggpht.com/_CSUuS5p4wm0/STTLFD28u8I/AAAAAAAAAF0/MQn5GC4F3HI/image_thumb%5B6%5D.png" width="724" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;To someone new to SQL Server, this looks like it might be performing a backup to c:\Sandbox.bak and making a duplicate or mirrored copy to d:\Sandbox.bak.&amp;#160; In reality, this is not the case.&amp;#160; Instead this is performing a striped backup similar to a RAID 0 disk which will write the data round robin to all of the files listed.&amp;#160; Striping backups can be used to improve performance of the backup operation, especially for VLDB's using multiple drives with dedicated I/O channels to each of the drives.&amp;#160; The backup TSQL command from the above scripted out would be:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;BACKUP DATABASE &lt;/span&gt;[Sandbox] &lt;br /&gt;&lt;span style="color: blue"&gt;TO  DISK &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;N&lt;span style="color: red"&gt;'c:\Sandbox.bak'&lt;/span&gt;&lt;span style="color: gray"&gt;,  &lt;br /&gt;    &lt;/span&gt;&lt;span style="color: blue"&gt;DISK &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;N&lt;span style="color: red"&gt;'d:\Sandbox.bak' &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;WITH &lt;/span&gt;FORMAT&lt;span style="color: gray"&gt;, &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;NAME &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;N&lt;span style="color: red"&gt;'Sandbox-Full Database Backup'&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;SKIP&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: blue"&gt;NOREWIND&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: blue"&gt;NOUNLOAD&lt;/span&gt;&lt;span style="color: gray"&gt;,  &lt;/span&gt;&lt;span style="color: blue"&gt;STATS &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;10&lt;br /&gt;GO&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;To create a mirrored backup, you can't use the UI in SQL Server Management Studio, you actually have to use TSQL Scripts following the Book Online entry for BACKUP DATABASE.&amp;#160; The MIRROR TO option is used to create the mirrored backup as follows:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;BACKUP DATABASE &lt;/span&gt;[Sandbox] &lt;br /&gt;&lt;span style="color: blue"&gt;TO  DISK &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;N&lt;span style="color: red"&gt;'c:\Sandbox.bak' &lt;br /&gt;&lt;/span&gt;MIRROR &lt;span style="color: blue"&gt;TO DISK &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;N&lt;span style="color: red"&gt;'d:\Sandbox.bak' &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;WITH FORMAT&lt;/span&gt;&lt;span style="color: gray"&gt;,&lt;/span&gt;&lt;span style="color: gray"&gt;  &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;NAME &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;N&lt;span style="color: red"&gt;'Sandbox-Full Database Backup'&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;SKIP&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: blue"&gt;NOREWIND&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: blue"&gt;NOUNLOAD&lt;/span&gt;&lt;span style="color: gray"&gt;,  &lt;/span&gt;&lt;span style="color: blue"&gt;STATS &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;10&lt;br /&gt;GO&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The bad thing as I stated previously in this post is that someone doesn't realize the mistake until it is to late.&amp;#160; When was the last time that you tested your backups?&amp;#160; Testing would have caught this problem well ahead of it actually being a problem.&amp;#160; &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-5453086067073736025?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/5453086067073736025/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/sql-server-backup-fundamentals-mirrored.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/5453086067073736025'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/5453086067073736025'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/sql-server-backup-fundamentals-mirrored.html' title='SQL Server Backup Fundamentals - Mirrored Backup vs Striped Backup'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_CSUuS5p4wm0/STTLFD28u8I/AAAAAAAAAF0/MQn5GC4F3HI/s72-c/image_thumb%5B6%5D.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-6727044063712922099</id><published>2008-12-03T15:15:00.001-05:00</published><updated>2008-12-03T15:15:47.204-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='TSQL'/><title type='text'>Creating an Indexed View with a Self-Join (Kinda)</title><content type='html'>&lt;p&gt;The following is based on a &lt;a href="http://forums.microsoft.com/Forums/ShowPost.aspx?PostID=4200182&amp;amp;SiteID=1"&gt;post on the MSDN Forums&lt;/a&gt; regarding building an indexed view in SQL Server.&lt;/p&gt;  &lt;p&gt;Indexed Views are another tool in the toolset for squeezing performance out of SQL Server.&amp;#160; When applied correctly they can be very powerful, but they have so many limitations, that they really are very difficult to use.&amp;#160; The poster on the above thread hit one of these limitations that really seems kind of nonsensical when you are looking at the code, that being that a Indexed View can't have a self-join in its definition.&amp;#160; If you would like to know all about indexed views and how they work, as well as some examples you can play with in AdventureWorks take a look at the following whitepaper on MSDN:&lt;/p&gt;  &lt;h5&gt;&lt;a href="http://www.microsoft.com/technet/prodtechnol/sql/2005/impprfiv.mspx"&gt;Improving Performance with SQL Server 2005 Indexed Views &lt;b&gt;...&lt;/b&gt;&lt;/a&gt;&lt;/h5&gt;  &lt;p&gt;First to reproduce the problem we'll need to create some tables and data.&amp;#160; Don't worry, these will be reusable for this whole exercise:&lt;/p&gt;  &lt;p&gt;&lt;code style="font-size: 12px"&gt;&lt;span style="color: blue"&gt;SET NOCOUNT ON&lt;/span&gt;&lt;span style="color: gray"&gt;;        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: black"&gt;GO        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;USE &lt;/span&gt;&lt;span style="color: black"&gt;tempdb        &lt;br /&gt;GO         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;SET &lt;/span&gt;&lt;span style="color: black"&gt;ANSI_NULLS &lt;/span&gt;&lt;span style="color: blue"&gt;ON        &lt;br /&gt;SET &lt;/span&gt;&lt;span style="color: black"&gt;ANSI_PADDING &lt;/span&gt;&lt;span style="color: blue"&gt;ON        &lt;br /&gt;SET &lt;/span&gt;&lt;span style="color: black"&gt;ANSI_WARNINGS &lt;/span&gt;&lt;span style="color: blue"&gt;ON        &lt;br /&gt;SET &lt;/span&gt;&lt;span style="color: black"&gt;CONCAT_NULL_YIELDS_NULL &lt;/span&gt;&lt;span style="color: blue"&gt;ON        &lt;br /&gt;SET &lt;/span&gt;&lt;span style="color: black"&gt;NUMERIC_ROUNDABORT &lt;/span&gt;&lt;span style="color: blue"&gt;OFF        &lt;br /&gt;SET &lt;/span&gt;&lt;span style="color: black"&gt;QUOTED_IDENTIFIER &lt;/span&gt;&lt;span style="color: blue"&gt;ON        &lt;br /&gt;SET &lt;/span&gt;&lt;span style="color: black"&gt;ARITHABORT &lt;/span&gt;&lt;span style="color: blue"&gt;ON        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: black"&gt;GO        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;CREATE TABLE &lt;/span&gt;&lt;span style="color: black"&gt;dbo.dimColor &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;ColorID &lt;/span&gt;&lt;span style="color: blue"&gt;INT &lt;/span&gt;&lt;span style="color: #434343"&gt;IDENTITY &lt;/span&gt;&lt;span style="color: blue"&gt;PRIMARY KEY&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;ColorName &lt;/span&gt;&lt;span style="color: blue"&gt;VARCHAR&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;10&lt;/span&gt;&lt;span style="color: gray"&gt;))        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: black"&gt;GO        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.dimColor &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: red"&gt;'red'&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.dimColor &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: red"&gt;'blue'&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.dimColor &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: red"&gt;'black'&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.dimColor &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: red"&gt;'silver'&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: black"&gt;GO        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;CREATE TABLE &lt;/span&gt;&lt;span style="color: black"&gt;dbo.dimManufacturer &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;ManufacturerID &lt;/span&gt;&lt;span style="color: blue"&gt;INT &lt;/span&gt;&lt;span style="color: #434343"&gt;IDENTITY &lt;/span&gt;&lt;span style="color: blue"&gt;PRIMARY KEY&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;ManufacturerName &lt;/span&gt;&lt;span style="color: blue"&gt;VARCHAR&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;10&lt;/span&gt;&lt;span style="color: gray"&gt;))        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: black"&gt;GO        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.dimManufacturer &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: red"&gt;'Ford'&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.dimManufacturer &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: red"&gt;'Chevrolet'&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: black"&gt;GO        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;CREATE TABLE &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;CarID &lt;/span&gt;&lt;span style="color: blue"&gt;INT &lt;/span&gt;&lt;span style="color: #434343"&gt;IDENTITY &lt;/span&gt;&lt;span style="color: blue"&gt;PRIMARY KEY&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;ManufacturerID &lt;/span&gt;&lt;span style="color: blue"&gt;INT&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;FirstColorID &lt;/span&gt;&lt;span style="color: blue"&gt;INT&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;SecondColorID &lt;/span&gt;&lt;span style="color: blue"&gt;INT&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: black"&gt;GO        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;3&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;4&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;3&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;4&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;3&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;3&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;3&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;3&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;3&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;4&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;4&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;4&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;4&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;3&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;4&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;4&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;3&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;4&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;3&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;4&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;3&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;3&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;3&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;3&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;3&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;4&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;4&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;4&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;4&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;3&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;4&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;4&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: black"&gt;GO&lt;/span&gt;&lt;/code&gt; &lt;/p&gt;  &lt;p&gt;To reproduce the original error reported in the forums post, we'll first create a view that has the &amp;quot;self-join&amp;quot; in its definition:&lt;/p&gt;  &lt;p&gt;&lt;code style="font-size: 12px"&gt;&lt;span style="color: blue"&gt;CREATE VIEW &lt;/span&gt;&lt;span style="color: black"&gt;dbo.CarDetails        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;WITH &lt;/span&gt;&lt;span style="color: black"&gt;SCHEMABINDING        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;AS        &lt;br /&gt;SELECT &lt;/span&gt;&lt;span style="color: black"&gt;c.CarID&lt;/span&gt;&lt;span style="color: gray"&gt;,        &lt;br /&gt;&amp;#160; &lt;/span&gt;&lt;span style="color: black"&gt;m.ManufacturerName&lt;/span&gt;&lt;span style="color: gray"&gt;,        &lt;br /&gt;&amp;#160; &lt;/span&gt;&lt;span style="color: black"&gt;pc.ColorName &lt;/span&gt;&lt;span style="color: blue"&gt;AS &lt;/span&gt;&lt;span style="color: black"&gt;[FirstColor]&lt;/span&gt;&lt;span style="color: gray"&gt;,        &lt;br /&gt;&amp;#160; &lt;/span&gt;&lt;span style="color: black"&gt;sc.ColorName &lt;/span&gt;&lt;span style="color: blue"&gt;AS &lt;/span&gt;&lt;span style="color: black"&gt;[SecondColor]        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars c        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;JOIN &lt;/span&gt;&lt;span style="color: black"&gt;dbo.dimManufacturer m &lt;/span&gt;&lt;span style="color: blue"&gt;ON &lt;/span&gt;&lt;span style="color: black"&gt;c.ManufacturerID &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;m.ManufacturerID        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INNER JOIN &lt;/span&gt;&lt;span style="color: black"&gt;dbo.dimColor pc &lt;/span&gt;&lt;span style="color: blue"&gt;ON &lt;/span&gt;&lt;span style="color: black"&gt;c.FirstColorID &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;pc.ColorID        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INNER JOIN &lt;/span&gt;&lt;span style="color: black"&gt;dbo.dimColor sc &lt;/span&gt;&lt;span style="color: blue"&gt;ON &lt;/span&gt;&lt;span style="color: black"&gt;c.SecondColorID &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;sc.ColorID        &lt;br /&gt;GO         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;CREATE UNIQUE CLUSTERED INDEX &lt;/span&gt;&lt;span style="color: black"&gt;CarDetails_CarID &lt;/span&gt;&lt;span style="color: blue"&gt;ON &lt;/span&gt;&lt;span style="color: black"&gt;dbo.CarDetails &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;CarID&lt;/span&gt;&lt;span style="color: gray"&gt;)        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: black"&gt;GO&lt;/span&gt;&lt;/code&gt; &lt;/p&gt;  &lt;p&gt;If you try to create this view, you will get an exception like the following&lt;/p&gt;  &lt;p&gt;&lt;code style="font-size: 12px"&gt;&lt;span style="color: red"&gt;Msg 1947, Level 16, State 1, Line 1 Cannot create index on view &amp;quot;tempdb.dbo.CarDetails&amp;quot;. The view contains a self join on &amp;quot;tempdb.dbo.dimColor&amp;quot;.&lt;/span&gt;&lt;/code&gt; &lt;/p&gt;  &lt;p&gt;So what exactly is it complaining about, after all there isn't a self join in the normal way that we would think of it? Well the self join statement is somewhat ambiguous, as is the self join limitation as listed in the whitepaper on MSDN. You actually can't join the same table two times in a indexed view, even if it is through another table. So what do you do if you have an actual structure like the one posted above where you have two foreign key columns to the same table and you need the double join to actually make sense of the data?&lt;/p&gt;  &lt;p&gt;I personally was confused by the error, so I built the above example and posted it to the MVP private groups to see if someone else could help shed some light onto the problem.&amp;#160; Assistance and a solution were provided by &lt;a href="http://www.users.drew.edu/skass/sql/index.htm"&gt;Steve Kass&lt;/a&gt; and &lt;a href="http://sqlblog.com/blogs/aaron_bertrand/"&gt;Aaron Bertrand&lt;/a&gt;, and the following example will show you how to code around this limitation.&lt;/p&gt;  &lt;p&gt;&lt;code style="font-size: 12px"&gt;&lt;span style="color: blue"&gt;CREATE TABLE &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Two &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;i &lt;/span&gt;&lt;span style="color: blue"&gt;INT&lt;/span&gt;&lt;span style="color: gray"&gt;)       &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Two &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;)       &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Two &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;2&lt;/span&gt;&lt;span style="color: gray"&gt;)       &lt;br /&gt;&lt;/span&gt;&lt;span style="color: black"&gt;GO       &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;CREATE VIEW &lt;/span&gt;&lt;span style="color: black"&gt;dbo.CarDetails_Imed       &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;WITH &lt;/span&gt;&lt;span style="color: black"&gt;SCHEMABINDING       &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;AS       &lt;br /&gt;SELECT        &lt;br /&gt;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: black"&gt;c.CarID&lt;/span&gt;&lt;span style="color: gray"&gt;,       &lt;br /&gt;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: black"&gt;m.ManufacturerName&lt;/span&gt;&lt;span style="color: gray"&gt;,       &lt;br /&gt;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: magenta"&gt;CASE &lt;/span&gt;&lt;span style="color: blue"&gt;WHEN &lt;/span&gt;&lt;span style="color: black"&gt;i &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;1 &lt;/span&gt;&lt;span style="color: blue"&gt;THEN &lt;/span&gt;&lt;span style="color: red"&gt;'FirstColor' &lt;/span&gt;&lt;span style="color: blue"&gt;ELSE &lt;/span&gt;&lt;span style="color: red"&gt;'SecondColor' &lt;/span&gt;&lt;span style="color: blue"&gt;END AS &lt;/span&gt;&lt;span style="color: black"&gt;whichColor&lt;/span&gt;&lt;span style="color: gray"&gt;,       &lt;br /&gt;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: magenta"&gt;CASE &lt;/span&gt;&lt;span style="color: blue"&gt;WHEN &lt;/span&gt;&lt;span style="color: black"&gt;i &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;1 &lt;/span&gt;&lt;span style="color: gray"&gt;AND &lt;/span&gt;&lt;span style="color: black"&gt;c.FirstColorID &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;pc.ColorID &lt;/span&gt;&lt;span style="color: blue"&gt;THEN &lt;/span&gt;&lt;span style="color: black"&gt;pc.ColorName       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: blue"&gt;WHEN &lt;/span&gt;&lt;span style="color: black"&gt;i &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;2 &lt;/span&gt;&lt;span style="color: gray"&gt;AND &lt;/span&gt;&lt;span style="color: black"&gt;c.SecondColorID &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;pc.ColorID &lt;/span&gt;&lt;span style="color: blue"&gt;THEN &lt;/span&gt;&lt;span style="color: black"&gt;pc.ColorName &lt;/span&gt;&lt;span style="color: blue"&gt;END AS &lt;/span&gt;&lt;span style="color: black"&gt;[Color]       &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Cars c       &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;JOIN &lt;/span&gt;&lt;span style="color: black"&gt;dbo.dimManufacturer m &lt;/span&gt;&lt;span style="color: blue"&gt;ON &lt;/span&gt;&lt;span style="color: black"&gt;c.ManufacturerID &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;m.ManufacturerID       &lt;br /&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;CROSS &lt;/span&gt;&lt;span style="color: blue"&gt;JOIN &lt;/span&gt;&lt;span style="color: black"&gt;dbo.Two       &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;INNER JOIN &lt;/span&gt;&lt;span style="color: black"&gt;dbo.dimColor pc &lt;/span&gt;&lt;span style="color: blue"&gt;ON &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;c.FirstColorID &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;pc.ColorID &lt;/span&gt;&lt;span style="color: gray"&gt;OR &lt;/span&gt;&lt;span style="color: black"&gt;c.SecondColorID &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;pc.ColorID&lt;/span&gt;&lt;span style="color: gray"&gt;)       &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;WHERE       &lt;br /&gt;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: magenta"&gt;CASE &lt;/span&gt;&lt;span style="color: blue"&gt;WHEN &lt;/span&gt;&lt;span style="color: black"&gt;i &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;1 &lt;/span&gt;&lt;span style="color: gray"&gt;AND &lt;/span&gt;&lt;span style="color: black"&gt;c.FirstColorID &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;pc.ColorID &lt;/span&gt;&lt;span style="color: blue"&gt;THEN &lt;/span&gt;&lt;span style="color: black"&gt;pc.ColorName       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: blue"&gt;WHEN &lt;/span&gt;&lt;span style="color: black"&gt;i &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;2 &lt;/span&gt;&lt;span style="color: gray"&gt;AND &lt;/span&gt;&lt;span style="color: black"&gt;c.SecondColorID &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;pc.ColorID &lt;/span&gt;&lt;span style="color: blue"&gt;THEN &lt;/span&gt;&lt;span style="color: black"&gt;pc.ColorName &lt;/span&gt;&lt;span style="color: blue"&gt;END IS &lt;/span&gt;&lt;span style="color: gray"&gt;NOT NULL       &lt;br /&gt;&lt;/span&gt;&lt;span style="color: black"&gt;GO       &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;CREATE UNIQUE CLUSTERED INDEX &lt;/span&gt;&lt;span style="color: black"&gt;CarDetailsImed_CarID &lt;/span&gt;&lt;span style="color: blue"&gt;ON &lt;/span&gt;&lt;span style="color: black"&gt;dbo.CarDetails_Imed &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;CarID&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;ManufacturerName&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;whichColor&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;Color&lt;/span&gt;&lt;span style="color: gray"&gt;)       &lt;br /&gt;&lt;/span&gt;&lt;span style="color: black"&gt;GO       &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;CREATE VIEW &lt;/span&gt;&lt;span style="color: black"&gt;dbo.CarDetails_Final       &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;WITH &lt;/span&gt;&lt;span style="color: black"&gt;SCHEMABINDING       &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;AS       &lt;br /&gt;SELECT &lt;/span&gt;&lt;span style="color: black"&gt;CarID&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;ManufacturerName&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;[FirstColor]&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;[SecondColor]       &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;FROM       &lt;br /&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;(       &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;SELECT       &lt;br /&gt;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: black"&gt;CarID&lt;/span&gt;&lt;span style="color: gray"&gt;,       &lt;br /&gt;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: black"&gt;ManufacturerName&lt;/span&gt;&lt;span style="color: gray"&gt;,       &lt;br /&gt;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: black"&gt;whichColor&lt;/span&gt;&lt;span style="color: gray"&gt;,       &lt;br /&gt;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: black"&gt;Color       &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;&lt;span style="color: black"&gt;dbo.CarDetails_Imed &lt;/span&gt;&lt;span style="color: blue"&gt;WITH &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;NOEXPAND&lt;/span&gt;&lt;span style="color: gray"&gt;)       &lt;br /&gt;) &lt;/span&gt;&lt;span style="color: black"&gt;src       &lt;br /&gt;PIVOT        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;(       &lt;br /&gt;&lt;/span&gt;&lt;span style="color: magenta"&gt;MAX&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;Color&lt;/span&gt;&lt;span style="color: gray"&gt;)       &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;FOR &lt;/span&gt;&lt;span style="color: black"&gt;whichColor &lt;/span&gt;&lt;span style="color: blue"&gt;IN &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;[FirstColor]&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;[SecondColor]&lt;/span&gt;&lt;span style="color: gray"&gt;)       &lt;br /&gt;) &lt;/span&gt;&lt;span style="color: black"&gt;pvt       &lt;br /&gt;GO&lt;/span&gt;&lt;/code&gt; &lt;/p&gt;  &lt;p&gt;The first thing Steve did was add a new table called dbo.Two into the mix.&amp;#160; This table has, you guessed it, two rows holding values 1 and 2 respectively.&amp;#160; Then he rewrote the query to use a cross join, so the output is going to be double the size in rows.&amp;#160; A slight error in code was corrected by Aaron initially, and then Steve provided the fix as well with the idea that you could pivot the data to get the output to match that of the original view since the cross join is going to be a normalized return instead of a denormalized output as in the original view. &lt;/p&gt;  &lt;p&gt;This view can now be indexed and used as an intermediate view to the actual results view which will pivot the data to provide the formatted output that would come from the original view that could not be indexed. One nice thing is that you can put the table hint WITH(NOEXPAND) directly into the output view DDL definition so that queries don't have to use this option explicitly. It has already been defined in the view itself. Since the intermediate view is now indexable, you can also create any needed covering indexes to satisfy the queries against the output view and assist with the pivot.&lt;/p&gt;  &lt;p&gt;I know this is a big hack to make something work, but it is one way to solve the problem. One final note is that since this uses the PIVOT operator it is not possible as coded above in SQL Server 2000. However, you can write a 2000 compliant pivot query that would still make use of the indexed intermediate view.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-6727044063712922099?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/6727044063712922099/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/creating-indexed-view-with-self-join.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/6727044063712922099'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/6727044063712922099'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/creating-indexed-view-with-self-join.html' title='Creating an Indexed View with a Self-Join (Kinda)'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-1879170971767174307</id><published>2008-12-03T08:22:00.000-05:00</published><updated>2008-12-03T08:22:00.242-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DBA Tutorials'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>Estimating the Size of your Database Backups</title><content type='html'>&lt;p&gt;I think I have answered a dozen or so questions regarding how to estimate the size of database backups without running the backup in the last few months on the Forums.&amp;#160; It is really quite simple to estimate how large a backup will be for a database.&amp;#160; The sp_spaceused system stored procedure will show how much reserved space there is in the database.&amp;#160; This is roughly equivalent to the size that the backup will be when it completes.&lt;/p&gt; &lt;code style="font-size: 12px"&gt;&lt;span style="color: blue"&gt;USE &lt;/span&gt;&lt;span style="color: black"&gt;SQLCLR_Examples      &lt;br /&gt;GO       &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;EXEC &lt;/span&gt;&lt;span style="color: darkred"&gt;sp_spaceused &lt;/span&gt;&lt;span style="color: #434343"&gt;@updateusage &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: red"&gt;'true'      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/code&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 0pt"&gt;&lt;span style="font-size: 8pt; font-family: &amp;#39;Courier New&amp;#39;"&gt;database_name&lt;span&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;database_size&lt;span&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;unallocated space&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 0pt"&gt;&lt;span style="font-size: 8pt; font-family: &amp;#39;Courier New&amp;#39;"&gt;------------------------------------- ------------------ ------------------&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 0pt"&gt;&lt;span style="font-size: 8pt; font-family: &amp;#39;Courier New&amp;#39;"&gt;SQLCLR_Examples&lt;span&gt;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;6031.50 MB&lt;span&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;4326.55 MB&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 0pt"&gt;&lt;span style="font-size: 8pt; font-family: &amp;#39;Courier New&amp;#39;"&gt;reserved&lt;span&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;data&lt;span&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;index_size&lt;span&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;unused&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 0pt"&gt;&lt;span style="font-size: 8pt; font-family: &amp;#39;Courier New&amp;#39;"&gt;------------------ ------------------ ------------------ ------------------&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 0pt"&gt;&lt;span style="font-size: 8pt; font-family: &amp;#39;Courier New&amp;#39;"&gt;&lt;font style="background-color: #ffff00"&gt;988624 KB&lt;/font&gt;&lt;span&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;944216 KB&lt;span&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;43200 KB&lt;span&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;1208 KB&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p align="left"&gt;I create a backup with the following command:&lt;/p&gt; &lt;code style="font-size: 12px"&gt;&lt;span style="color: blue"&gt;BACKUP DATABASE &lt;/span&gt;&lt;span style="color: black"&gt;[SQLCLR_Examples]     &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;TO DISK = &lt;/span&gt;&lt;span style="color: red"&gt;N'D:\SQLCLR_Examples.bak'     &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;WITH &lt;/span&gt;&lt;span style="color: black"&gt;NOFORMAT&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;NOINIT&lt;/span&gt;&lt;span style="color: gray"&gt;,     &lt;br /&gt;&lt;/span&gt;&lt;span style="color: black"&gt;NAME &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: red"&gt;N'SQLCLR_Examples-Full Database Backup'&lt;/span&gt;&lt;span style="color: gray"&gt;,     &lt;br /&gt;&lt;/span&gt;&lt;span style="color: black"&gt;SKIP&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;NOREWIND&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;NOUNLOAD&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: black"&gt;STATS &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;10&lt;/span&gt;&lt;/code&gt;   &lt;p&gt;&lt;/p&gt;  &lt;p&gt;Then look at its size with the following command:&lt;/p&gt; &lt;code style="font-size: 12px"&gt;&lt;span style="color: blue"&gt;SELECT &lt;/span&gt;&lt;span style="color: magenta"&gt;CONVERT&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: blue"&gt;VARCHAR&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: magenta"&gt;CONVERT&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: blue"&gt;DECIMAL&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;18&lt;/span&gt;&lt;span style="color: gray"&gt;,&lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;), &lt;/span&gt;&lt;span style="color: black"&gt;backup_size&lt;/span&gt;&lt;span style="color: gray"&gt;/&lt;/span&gt;&lt;span style="color: black"&gt;1024&lt;/span&gt;&lt;span style="color: gray"&gt;))+ &lt;/span&gt;&lt;span style="color: red"&gt;' KB' &lt;/span&gt;&lt;span style="color: black"&gt;[Backup Size]      &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;&lt;span style="color: black"&gt;msdb.dbo.backupset     &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;WHERE &lt;/span&gt;&lt;span style="color: black"&gt;database_name &lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;&lt;span style="color: red"&gt;'SQLCLR_Examples'     &lt;br /&gt;&amp;#160; &lt;/span&gt;&lt;span style="color: gray"&gt;AND &lt;/span&gt;&lt;span style="color: black"&gt;backup_finish_date &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;gt; &lt;/span&gt;&lt;span style="color: magenta"&gt;DATEADD&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: black"&gt;hh&lt;/span&gt;&lt;span style="color: gray"&gt;, -&lt;/span&gt;&lt;span style="color: black"&gt;1&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: magenta"&gt;GETDATE&lt;/span&gt;&lt;span style="color: gray"&gt;())     &lt;br /&gt;      &lt;br /&gt;&lt;/span&gt;&lt;/code&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 0pt"&gt;&lt;span style="font-size: 8pt; font-family: &amp;#39;Courier New&amp;#39;"&gt;&lt;font color="#000000"&gt;Backup Size&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 0pt"&gt;&lt;span style="font-size: 8pt; font-family: &amp;#39;Courier New&amp;#39;"&gt;&lt;font color="#000000"&gt;---------------------------------&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 0pt"&gt;&lt;span style="font-size: 8pt; font-family: &amp;#39;Courier New&amp;#39;"&gt;&lt;font color="#000000"&gt;993573.5 KB&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;So you can see from this demonstration that the size of the backup is roughly equal to the reserved space in the database from sp_spaceused.&amp;#160; The updateusage parameter is sometimes needed to account for changes that have occured but are not yet reflected in the usage stats for the database.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-1879170971767174307?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/1879170971767174307/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/estimating-size-of-your-database.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/1879170971767174307'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/1879170971767174307'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/estimating-size-of-your-database.html' title='Estimating the Size of your Database Backups'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-6082132143928467053</id><published>2008-12-02T09:18:00.000-05:00</published><updated>2008-12-02T12:50:37.270-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DBA Tutorials'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>Find databases missing a backup</title><content type='html'>&lt;p&gt;If you manage multiple servers, and you don't have complete control over your database backups, then you need to be checking regularly that all of your databases are indeed being backed up.  With SQL Server 2008, Policy Based Management makes this very easy to do.  There is a Microsoft Books Online entry for this:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/cc645723.aspx"&gt;Monitoring and Enforcing &lt;em&gt;Best Practices&lt;/em&gt; by Using &lt;em&gt;Policy&lt;/em&gt;-&lt;em&gt;Based Management&lt;/em&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;You don't have to be on a SQL Server 2008 server to use PBM.  You can actually use it manually from SQL Server Management Studio by downloading the Express Edition of 2008 with Tools.  However, if you are not taking the leap to SQL Server 2008 anytime soon, you still need to know how to monitor this.  You can do so with a simple TSQL Query using a few system tables:&lt;/p&gt;  &lt;blockquote&gt;   &lt;br /&gt;&lt;code style="font-size: 12px;"&gt;&lt;span style="color:blue"&gt;SELECT &lt;/span&gt;&lt;span style="color:black"&gt;database_name&lt;/span&gt;&lt;span style="color:gray"&gt;, &lt;/span&gt;&lt;span style="color:black"&gt;last_backup&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:blue"&gt;FROM&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:gray"&gt;(&amp;nbsp;&amp;nbsp; &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:blue"&gt;SELECT &lt;/span&gt;&lt;span style="color:black"&gt;database_name&lt;/span&gt;&lt;span style="color:gray"&gt;, &lt;/span&gt;&lt;span style="color:magenta"&gt;MAX&lt;/span&gt;&lt;span style="color:gray"&gt;(&lt;/span&gt;&lt;span style="color:black"&gt;backup_finish_date&lt;/span&gt;&lt;span style="color:gray"&gt;) &lt;/span&gt;&lt;span style="color:black"&gt;[last_backup]&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:blue"&gt;FROM &lt;/span&gt;&lt;span style="color:black"&gt;msdb.dbo.backupset&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:blue"&gt;JOIN MASTER&lt;/span&gt;&lt;span style="color:black"&gt;..sysdatabases d &lt;/span&gt;&lt;span style="color:blue"&gt;ON &lt;/span&gt;&lt;span style="color:black"&gt;database_name &lt;/span&gt;&lt;span style="color:blue"&gt;= &lt;/span&gt;&lt;span style="color:black"&gt;d.name&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:blue"&gt;WHERE TYPE = &lt;/span&gt;&lt;span style="color:red"&gt;'d'&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:blue"&gt;GROUP BY &lt;/span&gt;&lt;span style="color:black"&gt;database_name&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:blue"&gt;UNION &lt;/span&gt;&lt;span style="color:gray"&gt;ALL&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:blue"&gt;SELECT &lt;/span&gt;&lt;span style="color:black"&gt;d.name&lt;/span&gt;&lt;span style="color:gray"&gt;, NULL&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:blue"&gt;FROM MASTER&lt;/span&gt;&lt;span style="color:black"&gt;..sysdatabases d&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:blue"&gt;WHERE &lt;/span&gt;&lt;span style="color:gray"&gt;NOT EXISTS (&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:blue"&gt;SELECT &lt;/span&gt;&lt;span style="color:black"&gt;1 &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:blue"&gt;FROM &lt;/span&gt;&lt;span style="color:black"&gt;msdb..backupset &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:blue"&gt;WHERE &lt;/span&gt;&lt;span style="color:black"&gt;d.name &lt;/span&gt;&lt;span style="color:blue"&gt;= &lt;/span&gt;&lt;span style="color:black"&gt;database_name&lt;/span&gt;&lt;span style="color:gray"&gt;)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;) &lt;/span&gt;&lt;span style="color:blue"&gt;AS &lt;/span&gt;&lt;span style="color:black"&gt;tab&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:blue"&gt;WHERE &lt;/span&gt;&lt;span style="color:black"&gt;tab.last_backup &lt;/span&gt;&lt;span style="color:gray"&gt;&amp;lt; &lt;/span&gt;&lt;span style="color:magenta"&gt;GETDATE&lt;/span&gt;&lt;span style="color:gray"&gt;()-&lt;/span&gt;&lt;span style="color:black"&gt;14 &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color:gray"&gt;OR &lt;/span&gt;&lt;span style="color:black"&gt;tab.last_backup &lt;/span&gt;&lt;span style="color:blue"&gt;IS &lt;/span&gt;&lt;span style="color:gray"&gt;NULL&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;&lt;/blockquote&gt;I intentionally use the legacy table sysdatabases table so that this script works across all platforms exactly the same way.  If you were to download the Express Edition of SQL Server 2008 Management Studio, you could hit all of your SQL Servers regardless of edition, (2000, 2005 and 2008) with this on a multi-server query.  Want to know how to do that, see my article on this&lt;br /&gt;&lt;blockquote&gt;&lt;h5&gt;&lt;a href="http://www.sqlservercentral.com/articles/SQL+Server+Management+Studio/63650/"&gt;Multiple Server Queries with SSMS 2008 - SQL Server Central&lt;/a&gt;&lt;/h5&gt;&lt;/blockquote&gt;&lt;p&gt;I know that is kind of a shameless plug, but it is what it is.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-6082132143928467053?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/6082132143928467053/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/find-databases-missing-backup.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/6082132143928467053'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/6082132143928467053'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/find-databases-missing-backup.html' title='Find databases missing a backup'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-3597868398462113281</id><published>2008-12-01T14:05:00.001-05:00</published><updated>2008-12-01T14:06:09.428-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DBA Tutorials'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>Automating Common DBA Tasks Complete Series</title><content type='html'>&lt;p&gt;I have blogged about this briefly in the past, but I am going to post a full link set to all of the code that I use to automate monitoring of my production database servers. All of the code is available on the MSDN Forums SQL Examples Wiki site, and I might back post the series in my blog at a later date but I may not.&amp;#160; The entire series is sub categorized under the main article &lt;a href="http://code.msdn.microsoft.com/SQLExamples/Wiki/View.aspx?title=AutomatedDBA&amp;amp;referringTitle=Home"&gt;Automating Common DBA Tasks&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Inside this the code is sub-categorized into TSQL monitoring through SQL Agent:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://code.msdn.microsoft.com/SQLExamples/Wiki/View.aspx?title=SQL2000CDOSysMail&amp;amp;referringTitle=Home"&gt;Configuring SQL Server 2000 Notification with CDOSys&lt;/a&gt;      &lt;br /&gt;&lt;a href="http://code.msdn.microsoft.com/SQLExamples/Wiki/View.aspx?title=DatabaseMailConfig&amp;amp;referringTitle=Home"&gt;Configuring SQL Server 2005/2008 Database Mail&lt;/a&gt;      &lt;br /&gt;&lt;a href="http://code.msdn.microsoft.com/SQLExamples/Wiki/View.aspx?title=Log%20file%20growth%20in%20SQL%20Server&amp;amp;referringTitle=Home"&gt;Log file growth in SQL Server&lt;/a&gt;      &lt;br /&gt;&lt;a href="http://code.msdn.microsoft.com/SQLExamples/Wiki/View.aspx?title=FileSpaceMon&amp;amp;referringTitle=Home"&gt;Monitor free space in the database files&lt;/a&gt;      &lt;br /&gt;&lt;a href="http://code.msdn.microsoft.com/SQLExamples/Wiki/View.aspx?title=DiskSpaceMon&amp;amp;referringTitle=Home"&gt;Monitor free space on the server hard disks&lt;/a&gt;      &lt;br /&gt;&lt;a href="http://code.msdn.microsoft.com/SQLExamples/Wiki/View.aspx?title=ErrorLogMon&amp;amp;referringTitle=Home"&gt;Monitor the SQL Server Error Log&lt;/a&gt;      &lt;br /&gt;&lt;a href="http://code.msdn.microsoft.com/SQLExamples/Wiki/View.aspx?title=LongRunningJobMon&amp;amp;referringTitle=Home"&gt;Monitor long running SQL Agent Jobs&lt;/a&gt;      &lt;br /&gt;&lt;a href="http://code.msdn.microsoft.com/SQLExamples/Wiki/View.aspx?title=FailedJobMon&amp;amp;referringTitle=Home"&gt;Monitor failed SQL Agent Jobs&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;and VBScript/WMI monitoring through Windows Task Scheduler:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://code.msdn.microsoft.com/SQLExamples/Wiki/View.aspx?title=ServiceStatusMon&amp;amp;referringTitle=Home"&gt;Monitor Service Status&lt;/a&gt;      &lt;br /&gt;&lt;a href="http://code.msdn.microsoft.com/SQLExamples/Wiki/View.aspx?title=SystemLogMon&amp;amp;referringTitle=Home"&gt;Monitor System Event Logs&lt;/a&gt;      &lt;br /&gt;&lt;a href="http://code.msdn.microsoft.com/SQLExamples/Wiki/View.aspx?title=ProcessInfoMon&amp;amp;referringTitle=Home"&gt;Monitor Running Process Information&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Please feel free to contact me and let me know if you have any issues with using this code.&amp;#160; It is not exactly identical to the code in my production servers since there is some proprietary information in my own production code, but the changes are only slightly minor, and I have done my best to test and validate the code I published, and it all should work as intended.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-3597868398462113281?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/3597868398462113281/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/automating-common-dba-tasks.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/3597868398462113281'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/3597868398462113281'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/automating-common-dba-tasks.html' title='Automating Common DBA Tasks Complete Series'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-595750810607023441</id><published>2008-12-01T13:18:00.001-05:00</published><updated>2008-12-01T15:22:43.421-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>Speaking at Tampa Code Camp</title><content type='html'>&lt;p&gt;I'll be presenting a session on &amp;quot;Determining when to use CLR in SQL&amp;quot; on Saturday, December 6, 2008 at the Tampa Code Camp event in Tampa, FL.&amp;#160; You can learn more about the event on their web site:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a title="http://www.tampacodecamp.com/" href="http://www.tampacodecamp.com/"&gt;http://www.tampacodecamp.com/&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Drop me a note if you will be attending so I can meet you.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-595750810607023441?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/595750810607023441/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/speaking-at-tampa-code-camp.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/595750810607023441'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/595750810607023441'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/12/speaking-at-tampa-code-camp.html' title='Speaking at Tampa Code Camp'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-2855245182271686607</id><published>2008-11-26T16:13:00.001-05:00</published><updated>2008-11-26T16:13:07.056-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DBA Tutorials'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>The Database Transaction Log - Part 2: How the Transaction Log Works</title><content type='html'>&lt;p&gt;The transaction log files are different from the database data files in the way that they are used, as well as how the space is allocated inside of them.&amp;#160; The Log files, unlike standard data files are written to sequentially.&amp;#160; For this reason, it is often best for the logs to be on dedicated disks for log use only.&amp;#160; Since the IO is all sequential, random I/O from the data files could impact performance of logging.&amp;#160; The log files are subdivided internally into Virtual Log Files as shown in the below picture from the Books Online:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_CSUuS5p4wm0/SS27213rF_I/AAAAAAAAAFQ/QvvKUXyMen8/s1600-h/VLFDivision6.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="125" alt="VLF Division" src="http://lh6.ggpht.com/_CSUuS5p4wm0/SS273DugA9I/AAAAAAAAAFU/Ymga5bc1eOs/VLFDivision_thumb6.png?imgmax=800" width="381" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The number of VLF's in the transaction log can be found using DBCC LOGINFO.&amp;#160; This is an undocumented command, but it provides some very useful information regarding the transaction log for a specific database.&amp;#160; The following image shows the output of DBCC LOGINFO for AdventureWorks on my laptop:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_CSUuS5p4wm0/SS273bKHAlI/AAAAAAAAAFY/ybE_B4QaOCw/s1600-h/image_thumb21.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="273" alt="image_thumb[2]" src="http://lh6.ggpht.com/_CSUuS5p4wm0/SS273xm1_QI/AAAAAAAAAFc/qt3JgHe2y_c/image_thumb2_thumb.png?imgmax=800" width="431" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;As can be seen in the image, there are 4 VLF's in the transaction log.&amp;#160; The FSeqNo provides the logical order of the VLF's inside of the physical log files.&amp;#160; The Status column provides information as to whether a specific VLF is currently being used (2) or if it is available for use (0).&amp;#160; FileSize and offset provide information about the actual location of the VLF inside the physical file structure, and how large the VLF actually is. The actual sizing of the VLF is important to pay attention to.&amp;#160; If your VLF's are to small, then you will have excessive numbers of VLF's in your log files.&amp;#160; If they are to large, then they won't truncate free space effectively or efficiently.&amp;#160; &lt;/p&gt;  &lt;p&gt;As mentioned previously, the transaction log is a sequentially written file that is used in a round robin fashion.&amp;#160; The start of the log file may not be the current start of the logical log.&amp;#160; The following image from the Books Online shows how a single log file with four virtual log files is used by the database server.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_CSUuS5p4wm0/SS274KQe87I/AAAAAAAAAFg/lIYlPDfYkTo/s1600-h/LogUsageSingleFile2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="133" alt="LogUsageSingleFile" src="http://lh4.ggpht.com/_CSUuS5p4wm0/SS274PLmj3I/AAAAAAAAAFk/lBPSdmZqSuk/LogUsageSingleFile_thumb2.png?imgmax=800" width="365" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The start of the logical log in this case is at the beginning of the third VLF.&amp;#160; Since the log is written sequentially, the log moves from the start of the third VLF through the fourth VLF and when it reaches the end of the file, starts back over at the beginning of the log file if there is free space.&amp;#160; So long as the end of the logical log never gets back to the start of the logical log, the transaction log will stay the same size.&lt;/p&gt;  &lt;p&gt;In a two file system, the files are used sequentially, and unlike the database data files which are striped.&amp;#160; With two transaction log files, the first file is used, and then the second file is written to following the below picture:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_CSUuS5p4wm0/SS274YtBioI/AAAAAAAAAFo/tsOfqvnocGc/s1600-h/TransactionLogMultiFileUsage4.jpg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="133" alt="TransactionLogMultiFileUsage" src="http://lh6.ggpht.com/_CSUuS5p4wm0/SS274ty2P9I/AAAAAAAAAFs/QNQpDJbY1zg/TransactionLogMultiFileUsage_thumb2.jpg?imgmax=800" width="710" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;As long as the log space is truncated, the logs can continue to be used in a round robin fashion that prevents growth from being required.&amp;#160; The mechanism for truncation differs depending on the recovery model selected for the database in question.&amp;#160; If the database is in FULL recovery,&amp;#160; then the log is truncated when it is backed up using the BACKUP LOG command.&amp;#160; In SIMPLE recovery, the log truncation occurs on checkpoint for all complete transactions.&amp;#160; The active portion of the transaction log should remain fairly small for SIMPLE Recovery.&amp;#160; Exceptions to this would be large long running transactions as covered in my previous posting.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-2855245182271686607?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/2855245182271686607/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/database-transaction-log-part-2-how.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2855245182271686607'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2855245182271686607'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/database-transaction-log-part-2-how.html' title='The Database Transaction Log - Part 2: How the Transaction Log Works'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_CSUuS5p4wm0/SS273DugA9I/AAAAAAAAAFU/Ymga5bc1eOs/s72-c/VLFDivision_thumb6.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-3190483750545782580</id><published>2008-11-26T15:04:00.001-05:00</published><updated>2008-11-26T15:04:59.704-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Book Reviews'/><title type='text'>What am I reading? : Pro SQL Server 2005 Assemblies (Robin Dewson and Julian Skinner)</title><content type='html'>&lt;p&gt;I tend to work in patterns, where I occasionally get caught up by a particular topic and buy every book that I can find on the topic so I can dig deep into that topic.&amp;#160; SQLCLR was one of those topics earlier this year, and for all the work that I have done, I don't actually have any SQLCLR running on a production SQL Server in my environment.&amp;#160; There are a number of reasons for this, primarily, that the databases where I might use it, don't belong to me, they are vendor databases and I can't go play around with them.&amp;#160; One of the books that I bought to learn from for SQLCLR was&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://www.amazon.com/Pro-SQL-Server-2005-Assemblies/dp/1590595661/ref=pd_bbs_sr_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1227707908&amp;amp;sr=8-1"&gt;Pro SQL Server 2005 Assemblies (Pro)&lt;/a&gt; by Robin Dewson and Julian Skinner&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;This book overall is not bad, but there are some technical errors in some of the information that it provides.&amp;#160; The brief stint on Memory Management is not technically accurate, and does not discuss the differences between 32bit and 64bit SQL Servers.&amp;#160; This book really is programmer based and not management or DBA targeted, so this may not mean that much to most people.&amp;#160; &lt;/p&gt;  &lt;p&gt;This book does a good job of introducing the structure and concepts for how to build the various SQLCLR Object types.&amp;#160; It also does a good job of providing some best practices for implementation that will make it easier for CLR code to be moved from the database tier in SQLCLR to a application tier, should scale out be required due to problems or growth.&amp;#160; The tips provided by the author actually save time, and make code reuse much easier between the application and the database.&lt;/p&gt;  &lt;p&gt;Based on the other books on SQLCLR that I have read, I would rate this one at the top of the list.&amp;#160; It gives the information needed to design and code SQLCLR objects in SQL Server.&amp;#160; Not all of the examples are actually good candidates for CLR use in my own opinion.&amp;#160; Some of them can be done with TSQL in a manner that performs better than the CLR provided, but the difference in performance is fairly minimal.&amp;#160; It could simply be that the authors needed an example that didn't require a bunch of supporting structure behind it to keep things simple.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-3190483750545782580?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/3190483750545782580/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/what-am-i-reading-pro-sql-server-2005.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/3190483750545782580'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/3190483750545782580'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/what-am-i-reading-pro-sql-server-2005.html' title='What am I reading? : Pro SQL Server 2005 Assemblies (Robin Dewson and Julian Skinner)'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-6562418141311952190</id><published>2008-11-25T20:34:00.002-05:00</published><updated>2009-05-12T14:05:56.447-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Deadlocking'/><title type='text'>Anatomy of a Deadlock - Part Deux</title><content type='html'>This post has been moved to my new blog at SQLBlog.  You can find its contents on the following link:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://sqlblog.com/blogs/jonathan_kehayias/archive/2008/11/25/anatomy-of-a-deadlock-part-deux.aspx"&gt;http://sqlblog.com/blogs/jonathan_kehayias/archive/2008/11/25/anatomy-of-a-deadlock-part-deux.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-6562418141311952190?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://sqlblog.com/blogs/jonathan_kehayias/archive/2008/11/25/anatomy-of-a-deadlock-part-deux.aspx' title='Anatomy of a Deadlock - Part Deux'/><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/6562418141311952190/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/anatomy-of-deadlock-part-deux.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/6562418141311952190'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/6562418141311952190'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/anatomy-of-deadlock-part-deux.html' title='Anatomy of a Deadlock - Part Deux'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-603680880672134440</id><published>2008-11-22T23:14:00.000-05:00</published><updated>2008-11-23T00:15:10.725-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='General'/><category scheme='http://www.blogger.com/atom/ns#' term='PASS Summit'/><title type='text'>PASS Summit 2008 Debriefing</title><content type='html'>&lt;p&gt;I didn't blog much from PASS and it was intentional.&amp;#160; Since I was covering PASS sessions for Universal Thread, I didn't put time into covering them on here.&amp;#160; You can read about the sessions I attended on the following link:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a title="http://www.utcoverage.com/PASS/2008" href="http://www.utcoverage.com/PASS/2008"&gt;http://www.utcoverage.com/PASS/2008&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Reading about PASS Summit sessions will never match up to the experience of actually attending PASS Summit in person.&amp;#160; For me personally, the sessions were good, but the social networking us what really should drive people to attending events like PASS Summit.&amp;#160; I met and spoke with people from over a dozen different countries this week.&amp;#160; There were many MVP's at the summit which was simply awesome since I got to meet and hang out with the people who been teaching me SQL Server for the last 4 years.&amp;#160; I also got to sit on a discussion panel on Automating DBA Tasks, sponsored by Quest Software as a fill in for Buck Woody who was not able to make it at the last minute.&amp;#160; &lt;/p&gt;  &lt;p&gt;If you'd like to catch up on PASS, check out the UT coverage above, but also check out the following &lt;a href="http://sqlinthewild.co.za/index.php/2008/11/23/pass-roundup/" target="_blank"&gt;blog post from Gail Shaw&lt;/a&gt; which lists some blogs to look at.&amp;#160; Also check out others that she missed:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://drsql.spaces.live.com/" target="_blank"&gt;drSQL (Louis Davidson)&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;If you aren't a member of PASS, I'd recommend that you join, it is after all free.&amp;#160; &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-603680880672134440?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/603680880672134440/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/pass-summit-2008-debriefing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/603680880672134440'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/603680880672134440'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/pass-summit-2008-debriefing.html' title='PASS Summit 2008 Debriefing'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-4917836040909859444</id><published>2008-11-21T19:50:00.000-05:00</published><updated>2008-12-04T15:06:54.702-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Miscellaneous'/><title type='text'>SQL Heroes Contest Winners</title><content type='html'>&lt;p&gt;The contest winners were announced at PASS, albeit in a very anti-climactic manner.  The winners in order shown on the screen at PASS were:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Greg Galloway (with Darren Gosbell and John Welch)  &lt;a href="http://www.codeplex.com/bidshelper"&gt;http://www.codeplex.com/bidshelper&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;Jonathan Kehayias  &lt;a href="http://www.codeplex.com/ExtendedEventManager"&gt;http://www.codeplex.com/ExtendedEventManager&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;John Calvin Welch &lt;a href="http://www.codeplex.com/ssisUnit"&gt;http://www.codeplex.com/ssisUnit&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;Ignat Andrei &lt;a href="http://www.codeplex.com/CDCHelper/"&gt;http://www.codeplex.com/CDCHelper/&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;Jason Massie &lt;a href="http://www.codeplex.com/QPee"&gt;http://www.codeplex.com/QPee&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;br /&gt;&lt;br /&gt;EDIT:&lt;br /&gt;&lt;br /&gt;I was contacted regarding this list, and while I saw that the SQL Heroes blog posted a list of winners on 12/02/2008, I didn't actually notice that it has a different list of winners on it:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/sqlheroes/archive/2008/12/02/and-the-winners-are.aspx"&gt;http://blogs.msdn.com/sqlheroes/archive/2008/12/02/and-the-winners-are.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;So why the difference?  I am not really sure.  My list came from Brent Ozar who had the same problem I did at PASS Summit.  They flashed the list to fast for me to be able to copy it all down.  &lt;a href="http://www.brentozar.com/archive/2008/11/pass-summit-keynote-notes-sqlpass/"&gt;His blog post&lt;/a&gt; pointed me to &lt;a href="http://sqlblog.com/blogs/adam_machanic/archive/2008/11/21/pass-2008-friday-keynote-parallel-scale.aspx"&gt;Adam Machanic's blog&lt;/a&gt;, who I trust, so I felt safe reposting the same information on here, but apparently there was a discrepancy.  See the actual SQL Heroes blog to find the correct list which is:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;BIDS Helper&lt;/strong&gt;: Greg Galloway, Darren Gosbell, John Calvin  Welch  &lt;/li&gt;&lt;li&gt;&lt;strong&gt;SQL 2008 Extended Events Manager:&lt;/strong&gt; Jonathan Matthew Kehayias   &lt;/li&gt;&lt;li&gt;&lt;strong&gt;ssisUnit:&lt;/strong&gt; John Calvin Welch  &lt;/li&gt;&lt;li&gt;&lt;strong&gt;SqlMonitoring Tool: &lt;/strong&gt;Robert &lt;u&gt;Hartskeerl&lt;/u&gt;  &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Allocation SQL Server Management Studio Add-in:&lt;/strong&gt; Daniel  Gould &lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-4917836040909859444?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/4917836040909859444/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/sql-heroes-contest-winners.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/4917836040909859444'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/4917836040909859444'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/sql-heroes-contest-winners.html' title='SQL Heroes Contest Winners'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-1170821601414014660</id><published>2008-11-19T08:41:00.000-05:00</published><updated>2008-11-19T08:41:00.875-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Security'/><category scheme='http://www.blogger.com/atom/ns#' term='Miscellaneous'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>Can a DBA function without rights to the Server OS?</title><content type='html'>&lt;p&gt;I see posts often regarding questions for what rights should be granted and to whom with regards to SQL server.&amp;#160; On this post I am going to address what rights should a DBA have to the Server itself based on the following question recently from the MSDN Forums:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://forums.microsoft.com/Forums/ShowPost.aspx?PostID=3972989&amp;amp;SiteID=1"&gt;What is a DBA/sa prevented from doing if not a local admin on the SQL Server?&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;If you read the above post, you will see that my answer is different from start to finish on the thread.&amp;#160; At first I would have said that a DBA needs to be a Local Administrator on their server, but this really doesn't stand up to the whole idea of least necessary permissions, that as a DBA I enforce myself.&amp;#160; I happen to be a Local Administrator on my servers at my job, but that really probably is overkill, and could be reduced.&amp;#160; So what rights would a DBA need to a SQL Server at the OS level?&lt;/p&gt;  &lt;p&gt;This is determined and or dictated by the definition of the role of a SQL Server DBA.&amp;#160; As a SQL Server DBA, there are certain things that I expect to be able to see and or do, and that I would argue belong within my realm of responsibility.&amp;#160; A short list of these tasks would be:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Monitoring Performance Counters &lt;/li&gt;    &lt;li&gt;Managing Database Files &lt;/li&gt;    &lt;li&gt;Managing SQL Server Updates and Service Pack Installations &lt;/li&gt;    &lt;li&gt;Viewing System Event Logs &lt;/li&gt;    &lt;li&gt;View active Processes on the Server through PerfMon or TaskManager &lt;/li&gt;    &lt;li&gt;Start and Stop SQL Services &lt;/li&gt;    &lt;li&gt;Monitor Available Disk Space &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Now arguably, the easiest way to accomplish the above is to make the DBA a member of the Local Administrators group on the SQL Server, and I would never argue against this practice, it is after all the DBA's job on the line if the server goes down from a mistake they made as a local administrator by goofing with something they shouldn't have.&amp;#160; I personally like having the rope to hang myself, but I can also use that same rope to climb out of a valley in the event of an emergency as well.&amp;#160; I personally know my limits, and I know when to involve my server team members with looking at a problem.&amp;#160; This may or may not be due to my past experience as an NT4 and Windows Server 2000 Administrator, it was something close to 8 years ago, but I know where to draw the line of responsibility.&lt;/p&gt;  &lt;p&gt;So where do you sit on this subject?&amp;#160; I am interested to know if you are a DBA that doesn't have Administrator Access to the Windows Server, how you created permissions to do the above.&amp;#160; How would one go about granting the individual rights required to be a DBA without being a Local Administrator?&amp;#160; I can only figure out how to grant a subset of the above, but as I said previously, I am not a Windows Administrator, MCSE, or any other sort of subject matter expert when it comes to security outside of the SQL Server database engine itself.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-1170821601414014660?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/1170821601414014660/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/can-dba-function-without-rights-to.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/1170821601414014660'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/1170821601414014660'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/can-dba-function-without-rights-to.html' title='Can a DBA function without rights to the Server OS?'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-6838518182158566893</id><published>2008-11-18T08:20:00.000-05:00</published><updated>2008-12-09T12:03:45.284-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PASS Summit'/><title type='text'>Off to PASS</title><content type='html'>&lt;p&gt;By the time this actually gets published live to everyone, I will be on a plane heading for Seattle.  Ah the wonders of the Internet, and all these cool new features I find on my blog like the ability to write something today and have it published in the future.  I probably won't be blogging heavily from PASS as I am writing reviews for Universal Thread which will be published online at:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://www.utcoverage.com/PASS/2008/"&gt;http://www.utcoverage.com/PASS/2008/&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;If something catches my eye, I might be inclined to double up my work, and document it here as well, if I find that I can dig into it a bit more and provide some example code and information not provided on the thread above.  I might get Part 2 of my Transaction Log series done on the flight which would allow me to publish that.  We'll see.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-6838518182158566893?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/6838518182158566893/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/off-to-pass.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/6838518182158566893'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/6838518182158566893'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/off-to-pass.html' title='Off to PASS'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-5046525217317463816</id><published>2008-11-17T23:20:00.001-05:00</published><updated>2008-11-17T23:20:25.968-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>Now on Twitter</title><content type='html'>&lt;p&gt;A comment recently asked if I am on Twitter.&amp;#160; Well I wasn't but I am now.&amp;#160; Not sure what exactly I plan to do with it, but I can post short blurbs on what I am doing at the moment throughout the day I guess.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.twitter.com/jmkehayias"&gt;http://www.twitter.com/jmkehayias&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;I try to keep my online information business oriented and professional, so don't expect a whole lot of random rambling on there, but we'll see where it goes.&amp;#160; Not much room to do more than plug some small random stuff, perhaps using it to plug good posts on other peoples blogs rather than re-blogging it here......&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-5046525217317463816?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/5046525217317463816/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/now-on-twitter.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/5046525217317463816'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/5046525217317463816'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/now-on-twitter.html' title='Now on Twitter'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-1490511874644500873</id><published>2008-11-17T14:49:00.001-05:00</published><updated>2008-11-17T14:49:40.343-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Book Reviews'/><title type='text'>What am I reading? : Inside Microsoft SQL Server(TM) 2005: The Storage Engine (Solid Quality Learning)</title><content type='html'>&lt;p&gt;Since I have a few excellent books that I have already read, I figured I would post some reviews of what I am not currently reading, but I have previously read, and I use regularly for reference as I am working or answering questions online.&amp;#160; &lt;/p&gt;  &lt;p&gt;This book is another must have for any production support DBA.&amp;#160; It is the &lt;a href="http://www.delmarlearning.com/Browse_Catalog.aspx?Cat1ID=AU&amp;amp;Cat2ID=CHM&amp;amp;Cat3ID=CHM07"&gt;Chilton's Manual&lt;/a&gt;/&lt;a href="http://www.haynes.com/"&gt;Haynes Manual&lt;/a&gt; for SQL Server.&amp;#160; I have this book for SQL 2000 and 2005, and I pre-ordered the SQL 2008 version the day that it was available for pre-order on Amazon.&amp;#160; This book actually has some really good reviews on Amazon already:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://www.amazon.com/Inside-Microsoft-SQL-Server-2005/dp/0735621055/ref=pd_bbs_sr_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1226949963&amp;amp;sr=8-1"&gt;Inside Microsoft SQL Server(TM) 2005: The Storage Engine (Solid Quality Learning)&lt;/a&gt; by Kalen Delaney&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;This book is really intended for those who want/need to know the how and why for the way that the Storage Engine works in SQL Server 2005.&amp;#160; It is really is a must for anyone building or architecting an enterprise database solution or looking to upgrade/install SQL Server 2005.&amp;#160; It is not a beginners book at all, in fact I wouldn't recommend that a beginner start off with this book due to the depth of information contained in the book.&amp;#160; It would be very easy to get lost in the details of IAM, GAM, and SGAM allocations and never actually learn how to use SQL Server.&amp;#160; The table of contents for the book is:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Chapter 1 Installing and Upgrading to SQL Server 2005&lt;/p&gt;    &lt;p&gt;Chapter 2 SQL Server 2005 Architecture&lt;/p&gt;    &lt;p&gt;Chapter 3 SQL Server 2005 Configuration&lt;/p&gt;    &lt;p&gt;Chapter 4 Databases and Database Files&lt;/p&gt;    &lt;p&gt;Chapter 5 Logging and Recovery&lt;/p&gt;    &lt;p&gt;Chapter 6 Tables&lt;/p&gt;    &lt;p&gt;Chapter 7 Index Internals and Management&lt;/p&gt;    &lt;p&gt;Chapter 8 Locking and Concurrency&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;My favorite chapters have to be Chapter 5 and Chapter 8.&amp;#160; These are two of the most misunderstood concepts in SQL Server from working on the forums.&amp;#160; The level of detail included by Kalen in these chapters is excellent.&amp;#160; Expect the SQL Server 2008 version of this book to be even better as Kalen is joined by industry expert Paul Randal and his wife Kimberly Tripp as well as Conor Cunningham from Microsoft.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Additional Resources:&lt;/strong&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://www.amazon.com/Inside-Microsoft-SQL-Server-2000/dp/0735609985/ref=sr_1_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1226950181&amp;amp;sr=1-1"&gt;Inside Microsoft SQL Server 2000&lt;/a&gt; by Kalen Delaney      &lt;br /&gt;&lt;a href="http://www.amazon.com/Microsoft%C2%AE-SQL-Server%C2%AE-2008-Internals/dp/0735626243/ref=pd_bbs_sr_3?ie=UTF8&amp;amp;s=books&amp;amp;qid=1226951187&amp;amp;sr=8-3"&gt;Microsoft&amp;#174; SQL Server&amp;#174; 2008 Internals (Pro - Developer)&lt;/a&gt; by Kalen Delaney, Paul S. Randal, Kimberly L. Tripp, and Conor Cunningham (Paperback - Feb 18, 2009)&lt;/p&gt;&lt;/blockquote&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-1490511874644500873?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/1490511874644500873/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/what-am-i-reading-inside-microsoft-sql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/1490511874644500873'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/1490511874644500873'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/what-am-i-reading-inside-microsoft-sql.html' title='What am I reading? : Inside Microsoft SQL Server(TM) 2005: The Storage Engine (Solid Quality Learning)'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-2606463256468750027</id><published>2008-11-13T22:50:00.001-05:00</published><updated>2008-11-13T22:54:04.561-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DBA Tutorials'/><category scheme='http://www.blogger.com/atom/ns#' term='Best Practices'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>The Database Transaction Log - Part 1: Managing Size</title><content type='html'>&lt;p&gt;This post will be the start of a series on the Database Transaction Log.&amp;nbsp; This started out as a single posting, but the topic is vast that there is no way to properly cover it in a single post.&amp;nbsp; I could probably write a mini pamphlet on the transaction log in SQL Server the topic is just that big.&amp;nbsp; I plan to focus on common problems that I consistently see on the MSDN Forums regarding the transaction log, as well as how to prevent/correct them.&lt;/p&gt; &lt;p&gt;The transaction log in SQL Server is one of the most important parts of a SQL Server database, as well as one of the most common generators of problems I see online.&amp;nbsp; If you don't believe me, do a &lt;a href="http://www.google.com/search?hl=en&amp;amp;q=transaction+log+full&amp;amp;aq=f&amp;amp;oq=" target="_blank"&gt;Google&lt;/a&gt;, &lt;a href="http://search.msn.com/results.aspx?q=transaction+log+full&amp;amp;FORM=MSNH11&amp;amp;mkt=en-us" target="_blank"&gt;MSN&lt;/a&gt;, or &lt;a href="http://search.yahoo.com/search?p=transaction+log+full&amp;amp;fr=yfp-t-105&amp;amp;toggle=1&amp;amp;cop=mss&amp;amp;ei=UTF-8" target="_blank"&gt;Yahoo&lt;/a&gt; search for 'transaction log full', and you will find article after article and question after question dealing with the subject.&amp;nbsp; Worst yet are the stories of a deleted transaction log:&lt;/p&gt; &lt;p&gt;&lt;a title="http://www.sqlservercentral.com/articles/Disaster+Recovery/63311/" href="http://www.sqlservercentral.com/articles/Disaster+Recovery/63311/"&gt;http://www.sqlservercentral.com/articles/Disaster+Recovery/63311/&lt;/a&gt; &lt;br&gt;&lt;a title="https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2727860&amp;amp;SiteID=1" href="https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2727860&amp;amp;SiteID=1"&gt;https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2727860&amp;amp;SiteID=1&lt;/a&gt; &lt;br&gt;&lt;a title="http://bytes.com/forum/thread543465.html" href="http://bytes.com/forum/thread543465.html"&gt;http://bytes.com/forum/thread543465.html&lt;/a&gt;&lt;/p&gt; &lt;p&gt;To start with let me first say that you should never, ever, never, under any circumstances delete your database log file.&amp;nbsp; This is, as Jens Suessmeyer put it, "the transactional heart of the database."&amp;nbsp; &lt;/p&gt; &lt;p&gt;In a managed database server the database data/log files should only grow when specified by a Database Administrator.&amp;nbsp; This is not to say that you should turn AutoGrowth OFF on the databases in your environment.&amp;nbsp; I prefer that this option is left ON as a sort of insurance policy for your database in the event that the space available drops fast enough that you can't react in time to prevent a problem.&amp;nbsp; It should however, be configured to grow by a fixed size rather than a percentage.&amp;nbsp; The reason for this is that a fixed size has a predictable cost should the database have to grow automatically whereas a percentage size will be more and more expensive the larger the database grows to.&amp;nbsp; &lt;/p&gt; &lt;p&gt;I previously blogged about the &lt;a href="http://code.msdn.microsoft.com/SQLExamples/Wiki/View.aspx?title=AutomatedDBA" target="_blank"&gt;How to Automate Common DBA Tasks&lt;/a&gt; series that I posted on the MSDN Forums Example Site.&amp;nbsp; One of the articles included in that series is a &lt;a href="http://code.msdn.microsoft.com/SQLExamples/Wiki/View.aspx?title=FileSpaceMon" target="_blank"&gt;Data File Free Space monitoring script&lt;/a&gt;.&amp;nbsp; This can be used to monitor the available free space in the log files, and provide early notification to an administrator that they need to grow the file.&amp;nbsp; By manually managing the size of the log file, an administrator will know if there is a problem almost immediately.&amp;nbsp; The transaction log on an established database should very rarely have to be grown once properly sized.&lt;/p&gt; &lt;p&gt;So what exactly will cause the log file to fill up and need to be grown?&amp;nbsp; There are a number of things that can cause this:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;Full Recovery Model without Log Backups&lt;/li&gt; &lt;li&gt;Long running transaction&lt;/li&gt; &lt;li&gt;Uncommitted transaction&lt;/li&gt; &lt;li&gt;Rebuilding Indexes&lt;/li&gt; &lt;li&gt;Loading Bulk Data without minimizing logging.&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;The first item listed is the primary reason that log files get to be oversized, and eventually consume all of the available disk space on the server.&amp;nbsp; I have yet to figure out why or how, but almost every time that someone posts a problem with an oversized transaction log, the database is in FULL Recovery, and the only backups being performed are nightly full backups.&amp;nbsp; If you are not backing up the transaction log between full backups, then the database should be in SIMPLE recovery.&amp;nbsp; The reason for this is that the transaction log is not truncated in FULL recovery except by log backups using the BACKUP LOG command, and specifying WITH TRUNCATE_ONLY doesn't make sense.&amp;nbsp; If you aren't going to backup the logged data for point in time recovery purposes, then there is no reason to not have it auto truncate on checkpoint.&lt;/p&gt; &lt;p&gt;Long running transactions most often associated with a growing or oversized transaction log are generally data purging processes that are running as a single transaction like the following:&lt;/p&gt; &lt;blockquote&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;DELETE &lt;br /&gt;FROM MYTABLE&lt;br /&gt;WHERE MYCOL &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt; @Criteria&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;p&gt;Purging data like this will be heavily logged, even on databases in SIMPLE recovery.&amp;nbsp; The reason being that there is no commit between the start and commit, so if one million rows are being deleted, then the log has to hold all one million deletes to be able to perform a rollback of the operation.&amp;nbsp; The appropriate way to purge data like this was provided by fellow forum member Adam Haines in response to numerous forums postings:&lt;/p&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;DECLARE &lt;/span&gt;@BatchSize &lt;span style="color: blue"&gt;INT&lt;/span&gt;&lt;span style="color: gray"&gt;,&lt;br /&gt;        &lt;/span&gt;@Criteria &lt;span style="color: blue"&gt;DATETIME&lt;br /&gt;SET &lt;/span&gt;@BatchSize &lt;span style="color: gray"&gt;= &lt;/span&gt;1000&lt;br /&gt;&lt;span style="color: blue"&gt;SET &lt;/span&gt;@Criteria &lt;span style="color: gray"&gt;= &lt;/span&gt;&lt;span style="color: red"&gt;'1/1/2005'&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;WHILE &lt;/span&gt;&lt;span style="color: gray"&gt;EXISTS(&lt;/span&gt;&lt;span style="color: blue"&gt;SELECT &lt;/span&gt;1 &lt;span style="color: blue"&gt;FROM &lt;/span&gt;MYTABLE &lt;span style="color: blue"&gt;WHERE &lt;/span&gt;MYCOL &lt;span style="color: gray"&gt;&amp;lt; &lt;/span&gt;@Criteria&lt;span style="color: gray"&gt;)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;BEGIN&lt;br /&gt;    DELETE TOP &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;@BatchSize&lt;span style="color: gray"&gt;)&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;MYTABLE&lt;br /&gt;    &lt;span style="color: blue"&gt;WHERE &lt;/span&gt;MYCOL &lt;span style="color: gray"&gt;&amp;lt; &lt;/span&gt;@Criteria &lt;br /&gt;&lt;span style="color: blue"&gt;END&lt;/span&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;p&gt;Another solution to this problem was provided by Denis the SQL Menace is:&lt;/p&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;DECLARE @BatchSize INT&lt;/span&gt;&lt;span style="color: gray"&gt;,&lt;br /&gt;        @Criteria &lt;/span&gt;&lt;span style="color: blue"&gt;DATETIME&lt;/span&gt;&lt;span style="color: gray"&gt;,&lt;br /&gt;        @RowCount &lt;/span&gt;&lt;span style="color: blue"&gt;INT&lt;br /&gt;SET @BatchSize &lt;/span&gt;&lt;span style="color: gray"&gt;= 1000&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;SET @Criteria &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;&lt;span style="color: red"&gt;'20050101'&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;SET @RowCount &lt;/span&gt;&lt;span style="color: gray"&gt;= 1000&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;SET ROWCOUNT @BatchSize&lt;br /&gt; &lt;br /&gt;WHILE @RowCount &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;gt; 0&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;BEGIN&lt;br /&gt;    DELETE &lt;br /&gt;    FROM MYTABLE&lt;br /&gt;    WHERE MYCOL &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt; @Criteria&lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: blue"&gt;SELECT @RowCount &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;&lt;span style="color: magenta"&gt;@@rowcount &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;END&lt;br /&gt; &lt;br /&gt;SET ROWCOUNT 0&lt;br /&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;p&gt;Both of these solve the problem by working in smaller implicit transactions which will perform much better, as well as control the size of the transaction log.&amp;nbsp; &lt;/p&gt;&lt;br /&gt;&lt;p&gt;Uncommitted/Open transactions are problematic beyond just causing transaction log growth.&amp;nbsp; An open transaction will also cause excessive blocking in the database which will also impact the application users.&amp;nbsp; To find open transactions in a database, you can use DBCC OPENTRAN, which will return the active transactions in the current database.&amp;nbsp; To demonstrate this, run the following statement in one window:&lt;/p&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;use tempdb&lt;br /&gt;go&lt;br /&gt;create table mytable&lt;br /&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;(rowid &lt;/span&gt;&lt;span style="color: blue"&gt;int identity primary key&lt;/span&gt;&lt;span style="color: gray"&gt;)&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;begin transaction&lt;br /&gt;insert into mytable default values&lt;br /&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;p&gt;Then open a new window and run:&lt;/p&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;dbcc opentran&lt;br /&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;p&gt;The output from DBCC OPENTRAN will show the open transaction and offending SPID in the database as follows:&lt;/p&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;p&gt;&lt;font size="1"&gt;Transaction information for database 'tempdb'. &lt;/font&gt;&lt;br /&gt;&lt;p&gt;&lt;font size="1"&gt;Oldest active transaction:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SPID (server process ID): 55&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; UID (user ID) : -1&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : user_transaction&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LSN&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : (20:44:214)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Start time&amp;nbsp;&amp;nbsp;&amp;nbsp; : Nov 13 2008 10:35:09:780PM&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : 0x01050000000000051500000064116832e36ccd723422e75bba640000&lt;br&gt;DBCC execution completed. If DBCC printed error messages, contact your system administrator.&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;p&gt;To investigate this further, you can use DBCC INPUTBUFFER(spid#) to get the last command run on the offending SPID.&amp;nbsp; From there, you can determine what action you want to take, whether to kill the offending SPID and cause it to rollback, or maybe troubleshoot further to identify what caused the transaction to be left open.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Rebuilding Indexes and bulk loading data should both be done in SIMPLE or BULK_LOGGED recovery.&amp;nbsp; The reason for this is to minimize the logging that is done, but you can't eliminate it completely.&amp;nbsp; In my experience, rebuilding indexes can require a transaction log to be larger than the size of your largest index.&amp;nbsp; This is where sizing your log file is important as a part of future capacity planning, and should be done considering how large the database might be in the future.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;If you are reading this because you are already in trouble, there are a number of ways to deal with a oversized transaction log, and none of them necessitates deleting the file from the file system.&amp;nbsp; If you get yourself to the point that your server is completely out of disk space, there is no network path where you can backup your log to, and the log is in the hundreds of GB in size, then the best recommendation is to put the database into Simple recovery, which will truncate the active portion of the log and allow it to be shrunk.&amp;nbsp; I would highly caution and recommend that a new Full backup of your database be taken immediately after performing such an operation.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Look for further postings on the Transaction Log to come.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;References:&lt;br&gt;&lt;a title="http://support.microsoft.com/kb/873235" href="http://support.microsoft.com/kb/873235"&gt;http://support.microsoft.com/kb/873235&lt;/a&gt;&lt;br&gt;&lt;a href="http://support.microsoft.com/kb/317375/"&gt;http://support.microsoft.com/kb/317375/&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-2606463256468750027?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/2606463256468750027/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/database-transaction-log-part-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2606463256468750027'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2606463256468750027'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/database-transaction-log-part-1.html' title='The Database Transaction Log - Part 1: Managing Size'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-15547222504938107</id><published>2008-11-11T20:51:00.001-05:00</published><updated>2008-11-11T20:51:18.757-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2008'/><title type='text'>New Wrapper installer for SQL Express 2008</title><content type='html'>&lt;p&gt;If you've ever installed SQL Express 2008, the work required to install the prerequisites before you can actually install SQL Express 2008 was almost maddening.&amp;#160; Microsoft has made this much easier by releasing a new wrapper for the installation that will automatically download and install the dependencies for you, making the process much easier than before.&amp;#160; You can read about this on the SQL Express blogs on MSDN.&lt;/p&gt;  &lt;p&gt;&lt;a title="http://blogs.msdn.com/sqlexpress/archive/2008/11/05/announcing-the-sql-express-2008-installation-package.aspx" href="http://blogs.msdn.com/sqlexpress/archive/2008/11/05/announcing-the-sql-express-2008-installation-package.aspx"&gt;http://blogs.msdn.com/sqlexpress/archive/2008/11/05/announcing-the-sql-express-2008-installation-package.aspx&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-15547222504938107?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/15547222504938107/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/new-wrapper-installer-for-sql-express.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/15547222504938107'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/15547222504938107'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/new-wrapper-installer-for-sql-express.html' title='New Wrapper installer for SQL Express 2008'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-5653126483113096763</id><published>2008-11-11T12:58:00.001-05:00</published><updated>2008-11-11T12:58:29.226-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Book Reviews'/><title type='text'>What am I reading? : SQL Server 2005 Practical Troubleshooting: The Database Engine (Ken Henderson)</title><content type='html'>&lt;p&gt;I don't know if this affects other people, but I often have problems deciding which books I want to buy and or read.&amp;#160; So in an attempt to assist others in making good book choices with what may be limited funding, that I will provide a brief review of my opinion of the books that I have read and or am currently reading.&amp;#160; Since I have quite a stack that I have read, I figured I would start off with my favorite SQL Server 2005 Book.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.amazon.com/SQL-Server-2005-Practical-Troubleshooting/dp/0321447743/ref=pd_bbs_sr_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1226424665&amp;amp;sr=8-1"&gt;SQL Server 2005 Practical Troubleshooting: The Database Engine (SQL Server Series)&lt;/a&gt; by Ken Henderson (Paperback - Dec 18, 2006)&lt;/p&gt;  &lt;p&gt;This in my opinion has to be one of the best resources for a SQL Server DBA when all hell breaks loose and there are serious problems with a SQL Server.&amp;#160; If you don't have a copy of it yet, I would highly recommend it.&amp;#160; Unlike most of the books that are out there, this book was written by the developers at Microsoft for SQL Server, and edited by the late Ken Henderson, whose own contributions to the SQL Community over the years was second to none.&amp;#160; This book gets down into the nitty gritty of SQL Server, how it functions and why, and how to resolve and troubleshoot some of the most complex problems with the Database Engine.&lt;/p&gt;  &lt;p&gt;What is really good about this book is that it provides in depth information and details that could only come from the internal development staff at Microsoft.&amp;#160; The book is divided into specific problem types and details to include stack dump data is included in the book text to demonstrate the problem being explained.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Chapter 1 Waiting and Blocking Issues&lt;/p&gt;    &lt;p&gt;Chapter 2 Data Corruption and Recovery Issues&lt;/p&gt;    &lt;p&gt;Chapter 3 Memory Issues&lt;/p&gt;    &lt;p&gt;Chapter 4 Procedure Cache Issues&lt;/p&gt;    &lt;p&gt;Chapter 5 Query Processor Issues&lt;/p&gt;    &lt;p&gt;Chapter 6 Server Crashes and Other Critical Failures&lt;/p&gt;    &lt;p&gt;Chapter 7 Service Broker Issues&lt;/p&gt;    &lt;p&gt;Chapter 8 SQLOS and Scheduling Issues&lt;/p&gt;    &lt;p&gt;Chapter 9 Tempdb Issues&lt;/p&gt;    &lt;p&gt;Chapter 10 Clustering Issues&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;One problem reported with the book is that Amazon lists it as coming with a CD included.&amp;#160; Mine didn't, and I am not concerned about it, but I'll provide the warning that you won't get a CD with your book if you order it.&amp;#160; Additionally, expect that it will take 3-4 weeks to get delivery of the book if you do order it online.&amp;#160; I am not sure why it took so long to arrive, but it was definitely worth the wait.&amp;#160; &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-5653126483113096763?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/5653126483113096763/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/what-am-i-reading-sql-server-2005.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/5653126483113096763'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/5653126483113096763'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/what-am-i-reading-sql-server-2005.html' title='What am I reading? : SQL Server 2005 Practical Troubleshooting: The Database Engine (Ken Henderson)'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-7526951734707567474</id><published>2008-11-10T11:45:00.000-05:00</published><updated>2008-11-10T11:45:00.626-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>How do I become a SQL MVP?</title><content type='html'>&lt;p&gt;I've been asked this both publicly and privately over the last month since I received the award, and I provided some information on a previous blog post &lt;a href="http://jmkehayias.blogspot.com/2008/10/congratulations-2009-microsoft-mvp.html"&gt;Congratulations 2009 Microsoft MVP&lt;/a&gt;.&amp;#160; The real answer is that there isn't a magic formula that can be followed to become a MVP in any technology, let alone SQL Server.&amp;#160; The key requirement to becoming an MVP for any technology is a demonstrated dedication to supporting the community over the past year.&amp;#160; How one actually goes about supporting the community differs person to person and case by case.&amp;#160; &lt;/p&gt;  &lt;p&gt;One thing to keep in mind is that quality is as important if not more important than quantity.&amp;#160; Posting responses to forums questions consistently but never actually answering the question at hand doesn't support the community very much.&amp;#160; Writing in a blog about personal information might build your blog post count, but it isn't centered towards a specific technology.&amp;#160; Being a member of a local user group and attending meetings but never presenting or being involved is good for personal learning, but not expanding the knowledge of the community.&amp;#160; &lt;/p&gt;  &lt;p&gt;One of the requirements is that you have to be nominated by an existing MVP, or a staff member at Microsoft.&amp;#160; This entails that you have or are doing something that gets noticed like answering questions efficiently and effectively online, while providing information to explain and educate the requestor as well as anyone who may find the post by searching later on.&amp;#160; Speaking at local events and writing articles that get published in print or online are other ways to get noticed.&amp;#160; At least for SQL Server, many of the speakers at local events are current or former, yes I said former, MVP's.&lt;/p&gt;  &lt;p&gt;So why did I say former?&amp;#160; The MVP award is only for one year, and if you stop contributing, you can be assured that you won't receive the award the following year.&amp;#160; Even if you do continue to contribute, it isn't guaranteed, see statement above about no magic recipe.&amp;#160; Each quarter the current MVP's whose award is expiring, and new candidates for MVP are reviewed by a team to determine who will receive the award.&lt;/p&gt;  &lt;p&gt;Hopefully that answers the question for anyone who is curious, while not answering the question since there isn't a definitive answer to this question.&amp;#160; Personally the first email I got about being nominated caught me off guard.&amp;#160; I certainly don't count myself amongst the ranks of MVP's like Paul Randal, Kimberly Tripp, Kalen Delaney, or the long list of other subject matter experts whose work is well above anything I have done.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-7526951734707567474?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/7526951734707567474/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/how-do-i-become-sql-mvp.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/7526951734707567474'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/7526951734707567474'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/how-do-i-become-sql-mvp.html' title='How do I become a SQL MVP?'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-5667300174879077312</id><published>2008-11-07T21:20:00.001-05:00</published><updated>2008-11-07T21:20:49.403-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Security'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA Tutorials'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='Best Practices'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>Are you safe without your Keys?</title><content type='html'>&lt;p&gt;I am not talking about your house keys, or your car keys, I am talking about your SQL Server Keys.&amp;#160; SQL Server 2005 allows you to use keys for protecting objects and data in the server and databases.&amp;#160; It is very likely that if you are doing encryption in SQL Server that you already know that you have keys in SQL, but if you have never touched encryption, you might now know that, you too, have at least one key in SQL, the &lt;a href="http://msdn.microsoft.com/en-us/library/ms189060(SQL.90).aspx" target="_blank"&gt;Service Master Key&lt;/a&gt;.&amp;#160; For those not familiar with this, the Service Master Key is the root of &lt;a href="http://msdn.microsoft.com/en-us/library/ms189586(SQL.90).aspx" target="_blank"&gt;encryption key hierarchy&lt;/a&gt; in SQL Server 2005, it is by default used to encrypt Database Master Keys, linked server security information, and any credentials created using &lt;a href="http://msdn.microsoft.com/en-us/library/ms189522.aspx" target="_blank"&gt;CREATE CREDENTIAL&lt;/a&gt;.&amp;#160; If you don't use any of the above, then read no further, you are probably fine.&lt;/p&gt;  &lt;p&gt;Personally, I learned about keys, certificates, and encryption while studying for my MCITP Database Administrator exams at the beginning of this year, and that was enough to add a backup of the SMK into a password protected file to my installation procedures for each SQL Server Instance I have.&amp;#160; I personally have never needed to use the backup to date.&amp;#160; So what sparked this blog posting?&amp;#160; As usual, &lt;a href="http://forums.microsoft.com/Forums/ShowPost.aspx?PostID=4100345&amp;amp;SiteID=1" target="_blank"&gt;a post on the MSDN Forums&lt;/a&gt;, where a backup of a database using encryption was restored to a different server, and the poster didn't know the password to the database master key.&amp;#160; After goofing the initial answer on it, I had to do some investigating into what could be done in the case that the password to encrypt a DbMK is lost, and the answer isn't all that complex, and it is included in the post referenced above.&amp;#160; &lt;/p&gt;  &lt;p&gt;However, it is much easier to just avoid the situation completely and have available backups of the SMK, as well as all the other keys in use in your database server. These can easily be done with DDL commands:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms190337(SQL.90).aspx"&gt;BACKUP SERVICE MASTER KEY (Transact-SQL)&lt;/a&gt;    &lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms187972(SQL.90).aspx"&gt;RESTORE SERVICE MASTER KEY (Transact-SQL)&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms174387(SQL.90).aspx"&gt;BACKUP MASTER KEY (Transact-SQL)&lt;/a&gt;    &lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms186336(SQL.90).aspx"&gt;RESTORE MASTER KEY (Transact-SQL)&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms178578(SQL.90).aspx"&gt;BACKUP CERTIFICATE (Transact-SQL)&lt;/a&gt;    &lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms187798(SQL.90).aspx"&gt;CREATE CERTIFICATE (Transact-SQL)&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;One of the best references online is &lt;a href="http://blogs.msdn.com/lcris/" target="_blank"&gt;Laurentiu Cristophors&lt;/a&gt; blog on MSDN for security and cryptography in SQL Server.&amp;#160; Laurentiu is a frequent answerer in the SQL Security forum on MSDN, and has wealth of information available about this subject.&amp;#160; His blog is definitely a recommended read and is on my personal blog roll.&lt;/p&gt;  &lt;p&gt;Since this is such a vast subject, I plan on putting some time into it in the near future, and writing some additional information on the subject.&amp;#160; However, in the mean time, backup those keys and certificates.&lt;/p&gt;  &lt;p&gt;EDIT:&amp;#160; One thing I realized while thinking about his blog is I do have two different Certificates implemented in my servers, one for mirroring between two servers not on a domain, and one for a certificate user to provide permissions for a dynamic SQL search procedure that uses parameterized dynamic SQL to perform optimized searching in one of our databases, since application users are required to use stored procedures and have no table level access.&amp;#160; The certificate user has no associated login and is used WITH EXECUTE AS to provide the needed table level SELECT rights to run dynamic SQL code in the stored procedure.&amp;#160; The calling user only has execute rights on the stored procedure but can still make use of its dynamic code due to this type of impersonation.&amp;#160; I do have backups of both of these certificates, as created when they were created.&lt;/p&gt;  &lt;p&gt;If you want more information about using Certificates to grant elevated rights with a Certificate User look at Erland Sommarskogs article &lt;i&gt;&lt;a href="http://www.sommarskog.se/grantperm.html"&gt;Giving Permissions through Stored Procedures&lt;/a&gt;&lt;/i&gt;.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-5667300174879077312?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/5667300174879077312/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/are-you-safe-without-your-keys.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/5667300174879077312'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/5667300174879077312'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/are-you-safe-without-your-keys.html' title='Are you safe without your Keys?'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-5929508128522131517</id><published>2008-11-07T10:33:00.001-05:00</published><updated>2008-12-09T18:31:17.589-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Query Processing'/><category scheme='http://www.blogger.com/atom/ns#' term='TSQL'/><title type='text'>Picking Random Rows from A Table</title><content type='html'>&lt;p&gt;Being that I work for a number of restaurant chains, I get some interesting requests/requirements for extracting data that has been collected through various marketing campaigns or contests.  A common request in the past has been to randomly pick a winner or randomly pick a list of winners from a particular set of data.  This seems like it should be pretty easy to do, but I was never able to figure out how to pick a truly random set of records without looping.  Until today, and the solution is really simple:&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;code  style="font-size:12px;"&gt;&lt;span style="color:blue;"&gt;USE &lt;/span&gt;&lt;span style="color:black;"&gt;[tempdb]&lt;br /&gt;GO&lt;br /&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;CREATE TABLE &lt;/span&gt;&lt;span style="color:black;"&gt;randomresults&lt;br /&gt;&lt;/span&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;&lt;span style="color:black;"&gt;id &lt;/span&gt;&lt;span style="color:blue;"&gt;INT &lt;/span&gt;&lt;span style="color: rgb(67, 67, 67);"&gt;IDENTITY &lt;/span&gt;&lt;span style="color:blue;"&gt;PRIMARY KEY&lt;/span&gt;&lt;span style="color:gray;"&gt;)&lt;br /&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;GO&lt;br /&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;INSERT INTO &lt;/span&gt;&lt;span style="color:black;"&gt;randomresults&lt;br /&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;DEFAULT VALUES&lt;br /&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;GO 100000  &lt;/span&gt;&lt;span style="color:green;"&gt;-- execute batch 100000 times&lt;br /&gt;-- Return rows in a random order&lt;br /&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;SELECT TOP &lt;/span&gt;&lt;span style="color:black;"&gt;10 id&lt;br /&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;FROM &lt;/span&gt;&lt;span style="color:black;"&gt;randomresults&lt;br /&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;ORDER BY &lt;/span&gt;&lt;span style="color:black;"&gt;checksum&lt;/span&gt;&lt;span style="color:gray;"&gt;(&lt;/span&gt;&lt;span style="color:magenta;"&gt;NEWID&lt;/span&gt;&lt;span style="color:gray;"&gt;())&lt;br /&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;GO&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;It doesn't matter how many times you run this, it will always return a completely random resultset.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-5929508128522131517?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/5929508128522131517/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/picking-random-rows-from-table.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/5929508128522131517'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/5929508128522131517'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/picking-random-rows-from-table.html' title='Picking Random Rows from A Table'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-5569613867536376874</id><published>2008-11-06T11:13:00.001-05:00</published><updated>2008-11-06T11:13:36.449-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DBA Tutorials'/><category scheme='http://www.blogger.com/atom/ns#' term='Best Practices'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>Are your Disks Aligned Properly?</title><content type='html'>&lt;p&gt;I am always on the lookout for new blogs to watch and learn from.&amp;#160; Not long ago, Kevin Kline wrote a very intriguing blog post:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/kevin_kline/archive/2008/10/08/how-to-improve-application-and-database-performance-up-to-40-in-one-easy-step.aspx"&gt;How to Improve Application and Database Performance up to 40% in One Easy Step&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;I read it, but I didn't get a lot of time to dig into it until recently.&amp;#160; I finally got around to digging into the topic more, and I also spoke to one of our server admin's about it.&amp;#160; Doing some research we found that our entire environment is running on misaligned partitions.&amp;#160; I found an additional resource blog post that has an excellent slide deck on the MSDN blogs by a guy name Jimmy May:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/jimmymay/archive/2008/10/14/disk-partition-alignment-for-sql-server-slide-deck.aspx"&gt;Disk Partition Alignment (Sector Alignment) for SQL Server: Part 1: Slide Deck&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;I am working on doing some testing of this by rebuilding a disk completely to see how it affects SQLIO benchmarks before and after.&amp;#160; I'll post results later on, but this topic is definitely an interesting subject.&lt;/p&gt;  &lt;p&gt;More to come........&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-5569613867536376874?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/5569613867536376874/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/are-your-disks-aligned-properly.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/5569613867536376874'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/5569613867536376874'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/are-your-disks-aligned-properly.html' title='Are your Disks Aligned Properly?'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-2841757536796834674</id><published>2008-11-04T14:15:00.001-05:00</published><updated>2008-11-04T14:26:27.621-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DBA Tutorials'/><category scheme='http://www.blogger.com/atom/ns#' term='Best Practices'/><title type='text'>Automating Common DBA Tasks</title><content type='html'>&lt;p&gt;A few weeks ago I did a live meeting presentation for the PASS Database Administrators Special Interests Group (DBA SIG) on Automating Common DBA Tasks.&amp;#160; I spent the last few weeks trying to figure out how to put the source code from my own processes online for others to view/use.&amp;#160; One problem I encountered is that I never designed this to be used by anyone other than myself, so the code wasn't really friendly to anyone but me.&amp;#160; I also did a number of things that are environment specific to my SQL Server environment, and were overly complex to try to explain online the how and or why behind them.&amp;#160; So in the end I reworked a majority of my own code into what I hope is an easy to follow, and easy to implement article series that I put up on the MSDN Forums Example site we use for the SQL Server Forums.&lt;/p&gt;  &lt;p&gt;&lt;a title="http://code.msdn.microsoft.com/SQLExamples/Wiki/View.aspx?title=AutomatedDBA" href="http://code.msdn.microsoft.com/SQLExamples/Wiki/View.aspx?title=AutomatedDBA"&gt;http://code.msdn.microsoft.com/SQLExamples/Wiki/View.aspx?title=AutomatedDBA&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;If you happen to have problems with any of the scripts, please let me know by leaving me a comment or sending me an email, and I will correct the problem immediately.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-2841757536796834674?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/2841757536796834674/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/automating-common-dba-tasks.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2841757536796834674'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2841757536796834674'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/11/automating-common-dba-tasks.html' title='Automating Common DBA Tasks'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-4459724500546460679</id><published>2008-10-29T22:13:00.001-04:00</published><updated>2008-12-09T18:34:27.057-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Saturdays'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA Tutorials'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2008'/><title type='text'>SQL 2008 Data Collector - Custom Performance Counter Set</title><content type='html'>&lt;p&gt;During my session "Server Monitoring Made Simple with SQL 2008" I covered the new Performance Studio, Management Data Warehouse, and Data Collectors in SQL Server 2008.  Someone asked how one would create a custom Performance Counter Collection and I wasn't prepared to answer that particular question.  However, I provided my blog link in my slide deck, and I said I would find the answer and post it, so hopefully that person actually reads my blog at some point, but if not, maybe someone else will benefit from this example.&lt;/p&gt;  &lt;p&gt;If you were to do a search online, you will find a number of examples that don't work and generate a XML error when you try to run the code.  The reason for this, is that almost every example I could find was written for CTP6 of SQL Server 2008.  I was able to figure out the proper XML namespace reference that is needed in the RTM of SQL Server 2008 to create a custom collector.&lt;/p&gt;  &lt;p&gt;Before you actually go out and create a completely custom data collector for performance counters, you should consider something.  The System Activity Collection Set that is one of the System Collection Sets, already includes over 60 performance counters as a collection item.  You can see what ones are already included by running the following query:&lt;/p&gt;&lt;br /&gt;&lt;code  style="font-size:12px;"&gt;&lt;span style="color:blue;"&gt;SELECT &lt;/span&gt;&lt;span style="color:black;"&gt;name&lt;/span&gt;&lt;span style="color:gray;"&gt;, &lt;/span&gt;&lt;span style="color:black;"&gt;frequency&lt;/span&gt;&lt;span style="color:gray;"&gt;, &lt;/span&gt;&lt;span style="color:green;"&gt;parameters&lt;br /&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;FROM &lt;/span&gt;&lt;span style="color:green;"&gt;syscollector_collection_items&lt;br /&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;WHERE &lt;/span&gt;&lt;span style="color:black;"&gt;name &lt;/span&gt;&lt;span style="color:blue;"&gt;= &lt;/span&gt;&lt;span style="color:red;"&gt;'Server Activity - Performance Counters'&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;&lt;p&gt;Since the definition of the collection items is XML based, you can click the XML Document and it will open in a new window with friendly formatting.  If you find that the default counters don't meet your specific needs, then you can use the following example to create a custom collection set:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;use &lt;/span&gt;msdb&lt;span style="color:gray;"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;--First create the collection set&lt;br /&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;declare &lt;/span&gt;@collection_set_id &lt;span style="color:blue;"&gt;int&lt;br /&gt;declare &lt;/span&gt;@collection_set_uid &lt;span style="color:blue;"&gt;uniqueidentifier&lt;br /&gt;&lt;br /&gt;exec &lt;/span&gt;[dbo]&lt;span style="color:gray;"&gt;.&lt;/span&gt;[sp_syscollector_create_collection_set]&lt;br /&gt;   @name&lt;span style="color:gray;"&gt;=&lt;/span&gt;&lt;span style="color:red;"&gt;N'Performance Counter Collection Set'&lt;/span&gt;&lt;span style="color:gray;"&gt;,&lt;br /&gt;   &lt;/span&gt;@collection_mode&lt;span style="color:gray;"&gt;=&lt;/span&gt;0&lt;span style="color:gray;"&gt;, &lt;/span&gt;&lt;span style="color:green;"&gt;--Let's start in cached mode.&lt;br /&gt;   &lt;/span&gt;@description&lt;span style="color:gray;"&gt;=&lt;/span&gt;&lt;span style="color:red;"&gt;N'Collects Performance Counters from PerfMon'&lt;/span&gt;&lt;span style="color:gray;"&gt;,&lt;br /&gt;   &lt;/span&gt;@target&lt;span style="color:gray;"&gt;=&lt;/span&gt;&lt;span style="color:red;"&gt;N''&lt;/span&gt;&lt;span style="color:gray;"&gt;, &lt;/span&gt;&lt;span style="color:green;"&gt;--Undocumented&lt;br /&gt;   &lt;/span&gt;@logging_level&lt;span style="color:gray;"&gt;=&lt;/span&gt;0&lt;span style="color:gray;"&gt;, &lt;/span&gt;&lt;span style="color:green;"&gt;--0 through 2 are valid&lt;br /&gt;   &lt;/span&gt;@days_until_expiration&lt;span style="color:gray;"&gt;=&lt;/span&gt;5&lt;span style="color:gray;"&gt;, &lt;/span&gt;&lt;span style="color:green;"&gt;--Let's just keep data 5 days. We will rollup for reporting.&lt;br /&gt;   &lt;/span&gt;@proxy_name&lt;span style="color:gray;"&gt;=&lt;/span&gt;&lt;span style="color:red;"&gt;N''&lt;/span&gt;&lt;span style="color:gray;"&gt;, &lt;/span&gt;&lt;span style="color:green;"&gt;--Use if you want it to run under something other than the SQL Agent svc account.&lt;br /&gt;   &lt;/span&gt;@schedule_name&lt;span style="color:gray;"&gt;=&lt;/span&gt;&lt;span style="color:red;"&gt;N'CollectorSchedule_Every_5min'&lt;/span&gt;&lt;span style="color:gray;"&gt;, &lt;/span&gt;&lt;span style="color:green;"&gt;--Built in schedule&lt;br /&gt;   &lt;/span&gt;@collection_set_id&lt;span style="color:gray;"&gt;=&lt;/span&gt;@collection_set_id &lt;span style="color:blue;"&gt;output&lt;/span&gt;&lt;span style="color:gray;"&gt;,&lt;br /&gt;   &lt;/span&gt;@collection_set_uid&lt;span style="color:gray;"&gt;=&lt;/span&gt;@collection_set_uid &lt;span style="color:blue;"&gt;output&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;-- Now create the collection item for the Performance Counters to be collected&lt;br /&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;declare &lt;/span&gt;@collector_type_uid &lt;span style="color:blue;"&gt;uniqueidentifier&lt;br /&gt;declare &lt;/span&gt;@collection_item_id &lt;span style="color:blue;"&gt;int&lt;br /&gt;&lt;br /&gt;select &lt;/span&gt;@collector_type_uid &lt;span style="color:gray;"&gt;= &lt;/span&gt;collector_type_uid&lt;br /&gt;&lt;span style="color:blue;"&gt;from &lt;/span&gt;[dbo]&lt;span style="color:gray;"&gt;.&lt;/span&gt;[syscollector_collector_types]&lt;br /&gt;&lt;span style="color:blue;"&gt;where &lt;/span&gt;name &lt;span style="color:gray;"&gt;= &lt;/span&gt;&lt;span style="color:red;"&gt;N'Performance Counters Collector Type'&lt;/span&gt;&lt;span style="color:gray;"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;exec &lt;/span&gt;[dbo]&lt;span style="color:gray;"&gt;.&lt;/span&gt;[sp_syscollector_create_collection_item]&lt;br /&gt;   @name&lt;span style="color:gray;"&gt;=&lt;/span&gt;&lt;span style="color:red;"&gt;N'Standard SQL Server Performance Counters'&lt;/span&gt;&lt;span style="color:gray;"&gt;,&lt;br /&gt;   &lt;/span&gt;@parameters&lt;span style="color:gray;"&gt;=&lt;/span&gt;&lt;span style="color:red;"&gt;N'&lt;br /&gt;&amp;lt;ns:PerformanceCountersCollector xmlns:ns="DataCollectorType"&amp;gt;&lt;br /&gt; &amp;lt;PerformanceCounters Objects="Processor" Counters="% Processor time" Instances="_Total" /&amp;gt;&lt;br /&gt; &amp;lt;PerformanceCounters Objects="Processor" Counters="% Privileged time" Instances="_Total" /&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;PerformanceCounters Objects="Memory" Counters="Available KBytes" Instances="*"  /&amp;gt;&lt;br /&gt; &amp;lt;PerformanceCounters Objects="Memory" Counters="Pages/sec" Instances="*"  /&amp;gt;&lt;br /&gt; &amp;lt;PerformanceCounters Objects="Memory" Counters="Committed Bytes" Instances="*"  /&amp;gt;&lt;br /&gt; &amp;lt;PerformanceCounters Objects="Memory" Counters="Commit limit" Instances="*"  /&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;PerformanceCounters Objects="System" Counters="Processor Queue Length" Instances="*"  /&amp;gt;&lt;br /&gt; &amp;lt;PerformanceCounters Objects="System" Counters="Context Switches/sec" Instances="*"  /&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;PerformanceCounters Objects="PhysicalDisk" Counters="Avg. Disk Queue Length" Instances="_Total" /&amp;gt;&lt;br /&gt; &amp;lt;PerformanceCounters Objects="PhysicalDisk" Counters="Avg. Disk sec/Read" Instances="_Total" /&amp;gt;&lt;br /&gt; &amp;lt;PerformanceCounters Objects="PhysicalDisk" Counters="Avg. Disk sec/Write" Instances="_Total" /&amp;gt;&lt;br /&gt; &amp;lt;PerformanceCounters Objects="PhysicalDisk" Counters="Disk Reads/sec" Instances="_Total" /&amp;gt;&lt;br /&gt; &amp;lt;PerformanceCounters Objects="PhysicalDisk" Counters="Disk Writes/sec" Instances="_Total" /&amp;gt;&lt;br /&gt; &amp;lt;PerformanceCounters Objects="PhysicalDisk" Counters="Disk Read Bytes/sec" Instances="_Total" /&amp;gt;&lt;br /&gt; &amp;lt;PerformanceCounters Objects="PhysicalDisk" Counters="Disk Write Bytes/sec" Instances="_Total" /&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;PerformanceCounters Objects="Process" Counters="% Processor time" Instances="sqlservr" /&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;PerformanceCounters Objects="SQLServer:Buffer Manager" Counters="Buffer Cache hit ratio" Instances="*" /&amp;gt;&lt;br /&gt; &amp;lt;PerformanceCounters Objects="SQLServer:Buffer Manager" Counters="Checkpoint pages/sec" Instances="*" /&amp;gt;&lt;br /&gt; &amp;lt;PerformanceCounters Objects="SQLServer:Buffer Manager" Counters="Page life expectancy" Instances="*" /&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;PerformanceCounters Objects="SQLServer:Memory Manager" Counters="Total Server Memory (KB)" Instances="*" /&amp;gt;&lt;br /&gt; &amp;lt;PerformanceCounters Objects="SQLServer:Memory Manager" Counters="Target Server Memory(KB)" Instances="*" /&amp;gt;&lt;br /&gt;          &lt;br /&gt; &amp;lt;PerformanceCounters Objects="SQLServer:SQL Statistics" Counters="Batch requests/sec" Instances="*"  /&amp;gt;&lt;br /&gt; &amp;lt;PerformanceCounters Objects="SQLServer:SQL Statistics" Counters="SQL Compilations/sec" Instances="*" /&amp;gt;&lt;br /&gt; &amp;lt;PerformanceCounters Objects="SQLServer:SQL Statistics" Counters="SQL Re-Compilations/sec" Instances="*" /&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;PerformanceCounters Objects="SQLServer:Databases" Counters="Transactions/sec" Instances="_Total" /&amp;gt;&lt;br /&gt; &amp;lt;PerformanceCounters Objects="SQLServer:Databases" Counters="Data File(s) Size (KB)" Instances="_Total" /&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;PerformanceCounters Objects="SQLServer:General Statistics" Counters="User Connections" Instances="*" /&amp;gt;&lt;br /&gt;&amp;lt;/ns:PerformanceCountersCollector&amp;gt;'&lt;/span&gt;&lt;span style="color:gray;"&gt;,&lt;br /&gt;   &lt;/span&gt;@collection_item_id&lt;span style="color:gray;"&gt;=&lt;/span&gt;@collection_item_id &lt;span style="color:blue;"&gt;output&lt;/span&gt;&lt;span style="color:gray;"&gt;,&lt;br /&gt;   &lt;/span&gt;@frequency&lt;span style="color:gray;"&gt;=&lt;/span&gt;5&lt;span style="color:gray;"&gt;,&lt;br /&gt;   &lt;/span&gt;@collection_set_id&lt;span style="color:gray;"&gt;=&lt;/span&gt;@collection_set_id&lt;span style="color:gray;"&gt;, &lt;/span&gt;&lt;span style="color:green;"&gt;--output from sp_syscollector_create_collection_set&lt;br /&gt;   &lt;/span&gt;@collector_type_uid&lt;span style="color:gray;"&gt;=&lt;/span&gt;@collector_type_uid&lt;br /&gt;&lt;br /&gt;&lt;span style="color:green;"&gt;--Start the collection&lt;br /&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;exec &lt;/span&gt;&lt;span style="color:maroon;"&gt;sp_syscollector_start_collection_set &lt;/span&gt;@collection_set_id &lt;span style="color:gray;"&gt;= &lt;/span&gt;@collection_set_id &lt;span style="color:green;"&gt;--output from sp_syscollector_create_collection_set&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Some thanks must go out to Jason Massie whose original post on this topic was the original foundation for the modified script above.  You can find his original post titled &lt;a href="http://statisticsio.com/Home/tabid/36/articleType/ArticleView/articleId/57/Creating-a-custom-data-collection-in-SQL-Server-2008.aspx"&gt;Creating a custom data collection in SQL Server 2008&lt;/a&gt; on his blog &lt;a href="http://www.statisticsio.com/"&gt;http://www.statisticsio.com&lt;/a&gt;.  It is one of the entries that was written for CTP6, but provided the foundation for what I have posted above, so I have to give credit where due.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-4459724500546460679?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/4459724500546460679/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/10/sql-2008-data-collector-custom.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/4459724500546460679'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/4459724500546460679'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/10/sql-2008-data-collector-custom.html' title='SQL 2008 Data Collector - Custom Performance Counter Set'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-1681663268492911282</id><published>2008-10-26T23:26:00.001-04:00</published><updated>2008-10-26T23:26:02.072-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Saturdays'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>Tool Tip for Presenters</title><content type='html'>&lt;p&gt;I made a personal note during Kendal Van Dykes presentation on XML in SQL Server to ask him what tool he was using to zoom in on his text during his demos yesterday at SQL Saturday.&amp;#160; I expected to find out about a tool that I would have to shell out a few dollars for, but instead Kendal was actually using a free tool from &lt;a href="http://technet.microsoft.com/en-us/sysinternals/bb897434.aspx" target="_blank"&gt;Microsoft SysInternals called ZoomIt&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;After downloading this tool tonight to play with it, I feel it is definitely worthy of a blog posting.&amp;#160; I know that a few people who read my blog also do presentations on SQL Server for their local user groups as well as for larger events, and this tool in my opinion is simply amazing.&amp;#160; A lot of times, I try to remember to set my font sizes in Management Studio to at least 14 points or larger so that the text is readable on the projected screen.&amp;#160; Saturday morning however, I missed setting the results text to a larger size and the resulting 8 point font was impossible to read even standing at the podium in front of the room.&amp;#160; To fix this would have meant closing down Management Studio and restarting it, which would have put even more dead space in my presentation than I already had due to a few demonstrations that would not run.&amp;#160; &lt;/p&gt;  &lt;p&gt;If you do any kind of public presentations, I highly recommend downloading this tool for use.&amp;#160; Many thanks to Kendal for letting me know about it after his session.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-1681663268492911282?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/1681663268492911282/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/10/tool-tip-for-presenters.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/1681663268492911282'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/1681663268492911282'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/10/tool-tip-for-presenters.html' title='Tool Tip for Presenters'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-3565592220157448050</id><published>2008-10-25T22:27:00.001-04:00</published><updated>2008-10-25T22:27:39.864-04:00</updated><title type='text'>SQL Saturday Debriefing</title><content type='html'>&lt;p&gt;After getting up at 5am, meeting one of our Administrators at work who was interested in seeing the BI presentations at 6am, and driving 2 hrs to Orlando, all that I can say is it was definitely worthwhile.&amp;#160; Aside from the fact that I was presenting two sessions today at SQLSaturday, I loved attending the event itself, and getting to meet all the people that I either communicate with by email, or interact with online.&amp;#160; I also got to chat with presenters from previous SQL Saturdays as well.&amp;#160; Some people in attendance were:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.devfish.net"&gt;Joe Healy&lt;/a&gt; from Microsoft &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.sqlservercentral.com/blogs/steve_jones/default.aspx"&gt;Steve Jones&lt;/a&gt;, who manages all content on &lt;a href="http://www.sqlservercentral.com"&gt;SQLServerCentral.com&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.sqlservercentral.com/blogs/andy_warren/default.aspx"&gt;Andy Warren&lt;/a&gt; who coordinates the SQL Saturday events&lt;/li&gt;    &lt;li&gt;&lt;a href="http://kendalvandyke.blogspot.com/"&gt;Kendal Van Dyke&lt;/a&gt; who does an excellent presentation on XML in SQL Server&lt;/li&gt;    &lt;li&gt;&lt;a href="http://arcanecode.wordpress.com/"&gt;Robert C Cain&lt;/a&gt; who does an excellent presentation on Full Text Search&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;There were many others as well.&amp;#160; Some key sessions were Steve Jones &lt;u&gt;The Modern Resume - Building Your Brand&lt;/u&gt;, and Kendal's &lt;u&gt;XML Features in SQL 2005&lt;/u&gt; which both drew over 30 attendees.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-3565592220157448050?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/3565592220157448050/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/10/sql-saturday-debriefing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/3565592220157448050'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/3565592220157448050'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/10/sql-saturday-debriefing.html' title='SQL Saturday Debriefing'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-4559367708243305010</id><published>2008-10-22T15:40:00.001-04:00</published><updated>2008-10-22T15:40:03.727-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DBA Tutorials'/><category scheme='http://www.blogger.com/atom/ns#' term='Miscellaneous'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>Doing a Live Meeting Presentations - Lessons Learned</title><content type='html'>&lt;p&gt;I did a Live Meeting Presentation for the PASS DBA SIG today on my lunch break, and what I had initially thought would be a easy online presentation rapidly fell apart.&amp;#160; Despite having practiced and tested the Live Meeting settings with the meeting coordinator, there were issues that prevented the attendees from joining onto the Live Meeting.&amp;#160; Had this been the only issue, the result would have simply been a minor delay as the meeting coordinator was able to login and get everyone connected to the meeting.&amp;#160; &lt;/p&gt;  &lt;p&gt;However, despite testing and running through the presentation ahead of time, ensuring that my demonstrations worked and were ready, I had issues with SSMS consistently crashing, and none of my SQL Agent Task demonstrations working as expected.&amp;#160; The root cause which I have figured out two hours later was the installation of a new IPS agent on all of our machines at work, including laptops which get plugged into the corporate domain.&amp;#160; This was installed in the background while I was working this morning.&amp;#160; I guess that will teach me to plug into the network a bit more often with my laptop in the future.&lt;/p&gt;  &lt;p&gt;Hopefully everyone who attended got something out of the meeting.&amp;#160; It didn't quite go as I had expected at all, but I was able to cover the content.&amp;#160; A copy of all the code and the database I use will be available on the PASS site as well as on the MSDN Code Project SQL Examples site that we use on the forums in the coming days.&amp;#160; I'll post links to both when they have been put up.&lt;/p&gt;  &lt;p&gt;If you attended the event, and have any feedback, please feel free to contact me by email and let me know your thoughts.&amp;#160; I am always open to criticism, as it will only help me improve in the future.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-4559367708243305010?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/4559367708243305010/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/10/doing-live-meeting-presentations.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/4559367708243305010'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/4559367708243305010'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/10/doing-live-meeting-presentations.html' title='Doing a Live Meeting Presentations - Lessons Learned'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-588670737011563870</id><published>2008-10-20T22:32:00.001-04:00</published><updated>2008-10-20T22:32:45.654-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Miscellaneous'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>SQL Server Health &amp; History (SQLH2) Now Open Source</title><content type='html'>&lt;p&gt;Last month I placed a feedback suggestion to Microsoft requesting the release of the SQLH2 source on codeplex for the community to maintain since Microsoft was no longer providing updates/changes to the project.&amp;#160; You can read the connect item here:&lt;/p&gt;  &lt;p&gt;&lt;a title="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=369941" href="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=369941"&gt;https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=369941&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;I found by accident tonight that the project was in fact made available open source on codeplex this month:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.codeplex.com/sqlh2" href="http://www.codeplex.com/sqlh2"&gt;http://www.codeplex.com/sqlh2&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;This is very cool, since the community can now drive ongoing changes and development of this awesome free tool.&amp;#160; I am not sure if my connect item had anything to do with this since it wasn't updated by Microsoft, but I did leave a comment on the connect letting them know it had been fulfilled and could be closed.&amp;#160; I plan to request to join the team that will be working on updates and changes to the app through codeplex soon.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-588670737011563870?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/588670737011563870/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/10/sql-server-health-history-sqlh2-now.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/588670737011563870'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/588670737011563870'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/10/sql-server-health-history-sqlh2-now.html' title='SQL Server Health &amp;amp; History (SQLH2) Now Open Source'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-3382128293931514202</id><published>2008-10-17T18:53:00.001-04:00</published><updated>2008-10-17T18:53:48.577-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DBA Tutorials'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>Automating Common DBA Tasks</title><content type='html'>&lt;p&gt;Wednesday, October 22, 2008, I will be presenting a Live Meeting session for the &lt;a href="http://www.sqlpass.org/Community/SIGs/DatabaseAdministrationSIG/tabid/80/Default.aspx"&gt;&lt;strong&gt;Database Administration&lt;/strong&gt;&lt;/a&gt; Special Interest Group of PASS at 12pm EST (Noon).&amp;#160; Information on the Live Meeting can be found on the link above, but I will post it here as well:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Meeting Abstract&lt;/strong&gt;    &lt;br /&gt;Database Administrators often spend hours each day doing the same repetitive tasks; checking Error Logs, Backups, Drive Space, Agent History, Job Logs, and other common &amp;#8220;checklist&amp;#8221; items.&amp;#160; Learn how to easily automate these common tasks in SQL Server 2000, 2005 and 2008 using the tools that are already available in the Operating System and SQL Server.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Meeting Details&lt;/strong&gt;    &lt;br /&gt;Meeting URL: &lt;a href="https://www.livemeeting.com/rm/microsoft/join"&gt;www.livemeeting.com/rm/microsoft/join&lt;/a&gt;    &lt;br /&gt;Meeting ID: SIGS    &lt;br /&gt;Meeting Key: SGISSIGS    &lt;br /&gt;Audio Conferencing (Toll-free): 1 (866) 231-6479    &lt;br /&gt;Participant Code: 2775795    &lt;br /&gt;Please mute your line once you dial-in to the audio portion of the meeting.    &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;FIRST TIME USERS: To save time before the meeting, check your system to make sure it is compatible with Microsoft Office Live Meeting at &lt;a href="https://www112.livemeeting.com/cc/microsoft"&gt;www112.livemeeting.com/cc/microsoft&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Hope to see you there.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-3382128293931514202?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/3382128293931514202/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/10/automating-common-dba-tasks.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/3382128293931514202'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/3382128293931514202'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/10/automating-common-dba-tasks.html' title='Automating Common DBA Tasks'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-271514374419826971</id><published>2008-10-16T19:18:00.001-04:00</published><updated>2008-10-16T19:18:01.605-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PASS Summit'/><title type='text'>Attending PASS Summit</title><content type='html'>&lt;p&gt;I have been back and forth about attending PASS Summit this year.&amp;#160; I really wanted to attend for a number of reasons, not the least of which being the announcement of the winners of the &lt;a href="http://blogs.msdn.com/sqlheroes/pages/sql-heroes-2008-official-contest-rules.aspx"&gt;SQL Heroes Contest&lt;/a&gt;. (You did vote in the &lt;a href="https://connect.microsoft.com/SQLServer/Survey/Survey.aspx?SurveyID=7231"&gt;SQL Heroes 2008 Community Finalists Survey&lt;/a&gt; didn't you?)&amp;#160; The deciding factor came the other day when I got the opportunity to attend PASS and report on the sessions I attend for Universal Thread Magazine.&amp;#160; You can read about previous Summits on the following links:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.utcoverage.com/PASS/2007/" href="http://www.utcoverage.com/PASS/2007/"&gt;http://www.utcoverage.com/PASS/2007/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.utcoverage.com/PASS/2006/"&gt;http://www.utcoverage.com/PASS/2006/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.utcoverage.com/PASS/2005/"&gt;http://www.utcoverage.com/PASS/2005/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;I'll also update my blog with posts as I can from there as well.&amp;#160; If you are attending let me know with a comment or an email through my profile here.&lt;/p&gt;  &lt;p&gt;&lt;a href="https://connect.microsoft.com/SQLServer/Survey/Survey.aspx?SurveyID=7231"&gt;&amp;#160;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-271514374419826971?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/271514374419826971/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/10/attending-pass-summit.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/271514374419826971'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/271514374419826971'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/10/attending-pass-summit.html' title='Attending PASS Summit'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-8827781037532654097</id><published>2008-10-14T20:07:00.003-04:00</published><updated>2009-02-24T11:25:05.014-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DBA Tutorials'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>Using SQL Client Configuration Alias to Create Linked Server</title><content type='html'>This post has been migrated to my new blog on SQLBlog.com.  You can find this post at the following address:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://sqlblog.com/blogs/jonathan_kehayias/archive/2008/10/14/using-sql-client-configuration-alias-to-create-linked-server.aspx"&gt;http://sqlblog.com/blogs/jonathan_kehayias/archive/2008/10/14/using-sql-client-configuration-alias-to-create-linked-server.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-8827781037532654097?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://sqlblog.com/blogs/jonathan_kehayias/archive/2008/10/14/using-sql-client-configuration-alias-to-create-linked-server.aspx' title='Using SQL Client Configuration Alias to Create Linked Server'/><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/8827781037532654097/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/10/using-sql-client-configuration-alias-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/8827781037532654097'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/8827781037532654097'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/10/using-sql-client-configuration-alias-to.html' title='Using SQL Client Configuration Alias to Create Linked Server'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-7353775426770462408</id><published>2008-10-09T08:55:00.001-04:00</published><updated>2008-10-09T08:55:26.113-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='Miscellaneous'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>SQL Hero's Contest Survey - Vote for your favorite project</title><content type='html'>&lt;p&gt;At the beginning of the year, Microsoft started a SQL Server 2008 Hero's contest, which was an open source contest to build a application leveraging SQL Server 2008 and one of the other newer technologies.&amp;#160; The official rules were:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://blogs.msdn.com/sqlheroes/pages/sql-heroes-2008-official-contest-rules.aspx" href="http://blogs.msdn.com/sqlheroes/pages/sql-heroes-2008-official-contest-rules.aspx"&gt;http://blogs.msdn.com/sqlheroes/pages/sql-heroes-2008-official-contest-rules.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Ten finalists have been picked, and you can vote for the top 5 on the connect site.&lt;/p&gt;  &lt;p&gt;&lt;a href="https://connect.microsoft.com/SQLServer/Survey/Survey.aspx?SurveyID=7231"&gt;SQL Heroes 2008 Community Finalists Survey&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;I encourage people to check out all the projects and give them a whirl.&amp;#160; There are a couple of really neat ones in there, and not just my own, I am having fun playing with a few of the others that were submitted.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-7353775426770462408?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/7353775426770462408/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/10/sql-hero-contest-survey-vote-for-your.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/7353775426770462408'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/7353775426770462408'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/10/sql-hero-contest-survey-vote-for-your.html' title='SQL Hero&amp;#39;s Contest Survey - Vote for your favorite project'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-7710905336441452374</id><published>2008-10-06T20:02:00.001-04:00</published><updated>2008-12-09T12:04:21.493-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Miscellaneous'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>Microsoft Announces "Kilamanjaro" as code name for SQL 2010</title><content type='html'>&lt;p&gt;&lt;a title="http://www.microsoft.com/presspass/press/2008/oct08/10-06BI08PR.mspx" href="http://www.microsoft.com/presspass/press/2008/oct08/10-06BI08PR.mspx"&gt;http://www.microsoft.com/presspass/press/2008/oct08/10-06BI08PR.mspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;This appears to be more of a overhaul addin to 2008 for BI based on the information, but it will be fun to be playing with CTP's again next year.  With the changing pace of technology today, database administrators and developers will have their work cut out for them if they plan to stay on top of the current releases and technology.  &lt;/p&gt;  &lt;p&gt;I also imagine that the turnover on book publishing is going to be significant for authors here, as the pace quickens.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-7710905336441452374?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/7710905336441452374/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/10/microsoft-announces-as-code-name-for.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/7710905336441452374'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/7710905336441452374'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/10/microsoft-announces-as-code-name-for.html' title='Microsoft Announces &amp;quot;Kilamanjaro&amp;quot; as code name for SQL 2010'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-372963640155880618</id><published>2008-10-03T13:17:00.001-04:00</published><updated>2008-10-03T13:17:28.579-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Miscellaneous'/><title type='text'>So you think MS-DOS is dead?</title><content type='html'>&lt;p&gt;A friend of mine posed a problem to me recently that I was able to solve using old MS-DOS command line tricks.&amp;#160; Recently I have been doing a good bit of work in HP-UX with Oracle since I am the backup for our Oracle DBA.&amp;#160; One thing that has done is to make me revisit the command line, something that I haven't had to deal with very much in recent years.&amp;#160; So I also started playing around with some stuff in the Windows Command line as well for how to automate certain tasks.&amp;#160; Take for instance, to output the results or text of executing a process at the command line, you can pump it to a file:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;process &amp;gt;&amp;gt; process_log.txt&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;One of the hardest things I had to remember was how to provide responses to prompts.&amp;#160; Take for instance the rskeymgmt utility that is used to extract the encryption key from Reporting Services for safe keeping.&amp;#160; No matter what switches you provide to the commandline call, it still always asks &amp;quot;Are you sure you want to extract the key from the Report Server? Yes(y)/No(n)&amp;quot;.&amp;#160; To get around this, you can create a text file called prompts.txt with a single like that has a letter Y .&amp;#160; Then you provide this file as the input for prompts:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;rskeymgmt &amp;lt; prompts.txt&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;What is crazy is that when I was younger, basically a script kiddy, this kind of stuff was very common place in the windows world, because the GUI wasn't always there.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-372963640155880618?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/372963640155880618/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/10/so-you-think-ms-dos-is-dead.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/372963640155880618'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/372963640155880618'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/10/so-you-think-ms-dos-is-dead.html' title='So you think MS-DOS is dead?'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-6932610350683485177</id><published>2008-10-01T11:10:00.001-04:00</published><updated>2008-10-01T11:10:48.658-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>Congratulations 2009 Microsoft MVP</title><content type='html'>&lt;p&gt;I received the following email this morning:&lt;/p&gt;  &lt;p&gt;Dear Jonathan Kehayias,   &lt;br /&gt;Congratulations! We are pleased to present you with the 2009 Microsoft&amp;#174; MVP Award! This award is given to exceptional technical community leaders who actively share their high quality, real world expertise with others.&lt;/p&gt;  &lt;p&gt;It is a true honor to be included in this group with people like Kalen Delaney, Paul Randall, Kimberly Tripp, Kevin Kline, Jacob Sebastian, Deepak Rangarajan and all of the other amazing MVP's for SQL Server.&amp;#160; Many thanks to the MVP's on the SQL Forums who have helped me along the way.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-6932610350683485177?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/6932610350683485177/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/10/congratulations-2009-microsoft-mvp.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/6932610350683485177'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/6932610350683485177'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/10/congratulations-2009-microsoft-mvp.html' title='Congratulations 2009 Microsoft MVP'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-979022704961402523</id><published>2008-09-30T13:03:00.001-04:00</published><updated>2008-09-30T13:03:53.589-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Saturdays'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA Tutorials'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>SQL Saturday #8 Orlando - October 25, 2008</title><content type='html'>&lt;p&gt;I'll be presenting two sessions at SQL Saturday in Orlando next month.&amp;#160; Virtualizing SQL Server, and Monitoring SQL Server 2008.&amp;#160; Don't know what SQL Saturday is?&amp;#160; Find out more on the SQL Saturday website:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlsaturday.com/eventhome.aspx?eventid=11"&gt;SQLSaturday #8 - Orlando 2008&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;There will also be an upcoming SQL Saturday event in Tampa at the beginning of 2009 hosted by the Tampa SQL Users Group, of which I am a member.&amp;#160; You can monitor this event as it&amp;#160; grows at the following site as well:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlsaturday.com/eventhome.aspx?eventid=13"&gt;SQLSaturday #10 - Tampa 2009&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Hope to see you there.&amp;#160; Also if there are any specific questions regarding one of the two topics above, send me a message, and I will try to cover that as a part of the presentation.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-979022704961402523?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/979022704961402523/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/09/sql-saturday-8-orlando-october-25-2008.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/979022704961402523'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/979022704961402523'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/09/sql-saturday-8-orlando-october-25-2008.html' title='SQL Saturday #8 Orlando - October 25, 2008'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-2141014808731717677</id><published>2008-09-27T22:49:00.001-04:00</published><updated>2008-09-27T22:49:16.615-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Query Processing'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA Tutorials'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2005'/><title type='text'>Monitoring the Plan Cache</title><content type='html'>&lt;p&gt;If you run SQL Server on a 64bit server, then something that you should be monitoring from time to time is the size of your procedure cache.&amp;#160; This is especially important if you have an application that issues adhoc/non-parameterized queries against the SQL Server.&amp;#160; Since the procedure cache is stored as a part of the BPool, it can starve your buffer cache for precious memory.&amp;#160; A simple query that can help monitor this is:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;with plancache_cte as     &lt;br /&gt;(select single=sum(case usecounts when 1 then 1&amp;#160;&amp;#160;&amp;#160; else 0 end),      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; singlesize=sum(case usecounts when 1 then cast(size_in_bytes as bigint)/1024 else 0 end),      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; reused=sum(case usecounts when 1 then 0 else 1 end),      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; reusedsize=sum(case usecounts when 1 then 0 else cast(size_in_bytes as bigint)/1024 end),      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; total=count(usecounts),      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; totalsize=sum(cast(size_in_bytes as bigint)/1024)      &lt;br /&gt;from sys.dm_exec_cached_plans) &lt;/p&gt;    &lt;p&gt;select      &lt;br /&gt;'Single use plans (usecounts=1)'= single,      &lt;br /&gt;'Single use plans size KB (usecounts=1)'= singlesize,      &lt;br /&gt;'Re-used plans (usecounts&amp;gt;1)'= reused,      &lt;br /&gt;'Re-used plans size KB (usecounts&amp;gt;1)'= reusedsize,      &lt;br /&gt;'re-use %'=cast(100.0*reused / total as dec(5,2)),      &lt;br /&gt;'total usecounts'=total,      &lt;br /&gt;'total cache size'=totalsize      &lt;br /&gt;from plancache_cte&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;The SQL Programability Team blogged a wonderful series of blog posts in January 2007, that cover this topic and explain exactly what is going on and how it was somewhat fixed in Service Pack 2 of SQL Server 2005&lt;/p&gt;  &lt;p&gt;&lt;a title="http://blogs.msdn.com/sqlprogrammability/archive/2007/01.aspx" href="http://blogs.msdn.com/sqlprogrammability/archive/2007/01.aspx"&gt;http://blogs.msdn.com/sqlprogrammability/archive/2007/01.aspx&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-2141014808731717677?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/2141014808731717677/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/09/monitoring-plan-cache.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2141014808731717677'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2141014808731717677'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/09/monitoring-plan-cache.html' title='Monitoring the Plan Cache'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-2044681107470696677</id><published>2008-09-24T17:29:00.001-04:00</published><updated>2008-09-24T20:32:49.123-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DBA Tutorials'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><category scheme='http://www.blogger.com/atom/ns#' term='Blocking'/><title type='text'>Monitoring for Blocked Processes On SQL 2005 - Extended Version</title><content type='html'>&lt;p&gt;To help better clarify how to do an end to end monitoring of blocked processes on SQL Server 2005 I am going to expand upon my previous blog posting.&amp;#160; To begin with, it is necessary to configure the blocked process threshold on the SQL Server so that it generates the blocked process report in a trace output:   &lt;br /&gt;    &lt;br /&gt;&lt;span style="color: maroon"&gt;sp_configure&lt;/span&gt;&lt;span style="color: red"&gt;'show advanced options'&lt;/span&gt;&lt;span style="color: gray"&gt;,&lt;/span&gt;1 &lt;span style="color: gray"&gt;;     &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;GO     &lt;br /&gt;RECONFIGURE&lt;/span&gt;&lt;span style="color: gray"&gt;;     &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;GO     &lt;br /&gt;&lt;/span&gt;&lt;span style="color: maroon"&gt;sp_configure&lt;/span&gt;&lt;span style="color: red"&gt;'blocked process threshold'&lt;/span&gt;&lt;span style="color: gray"&gt;,&lt;/span&gt;5 &lt;span style="color: gray"&gt;;     &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;GO     &lt;br /&gt;RECONFIGURE&lt;/span&gt;&lt;span style="color: gray"&gt;;     &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;GO&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;I chose the value 5 because if something is blocked for more than 5 seconds then that is a significant delay in performance and it is the lowest value you can set.&amp;#160; Once this has been done, a single event trace can be created to run on the server that will log the blocked process reports that get generated.&amp;#160; The below script will create this trace:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: green"&gt;/****************************************************/&lt;br /&gt;/* Created by: SQL Server Profiler 2005 */&lt;br /&gt;/* Date: 09/24/2008 11:12:03 AM */&lt;br /&gt;/****************************************************/&lt;br /&gt; &lt;br /&gt;-- Create a Queue&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;declare &lt;/span&gt;@rc &lt;span style="color: blue"&gt;int&lt;br /&gt;declare &lt;/span&gt;@TraceID &lt;span style="color: blue"&gt;int&lt;br /&gt;declare &lt;/span&gt;@maxfilesize &lt;span style="color: blue"&gt;bigint&lt;br /&gt;set &lt;/span&gt;@maxfilesize &lt;span style="color: gray"&gt;= &lt;/span&gt;50 &lt;br /&gt;&lt;span style="color: blue"&gt;exec &lt;/span&gt;@rc &lt;span style="color: gray"&gt;= &lt;/span&gt;&lt;span style="color: maroon"&gt;sp_trace_create &lt;/span&gt;@TraceID &lt;span style="color: blue"&gt;output&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;2&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: red"&gt;N'c:\BlockedProcessTrace'&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;@maxfilesize&lt;span style="color: gray"&gt;, NULL &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;if &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;@rc &lt;span style="color: gray"&gt;!= &lt;/span&gt;0&lt;span style="color: gray"&gt;) &lt;/span&gt;&lt;span style="color: blue"&gt;goto &lt;/span&gt;error&lt;br /&gt;&lt;span style="color: green"&gt;-- Client side File and Table cannot be scripted&lt;br /&gt;-- Set the events&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;declare &lt;/span&gt;@on &lt;span style="color: blue"&gt;bit&lt;br /&gt;set &lt;/span&gt;@on &lt;span style="color: gray"&gt;= &lt;/span&gt;1&lt;br /&gt;&lt;span style="color: blue"&gt;exec &lt;/span&gt;&lt;span style="color: maroon"&gt;sp_trace_setevent &lt;/span&gt;@TraceID&lt;span style="color: gray"&gt;, &lt;/span&gt;137&lt;span style="color: gray"&gt;, &lt;/span&gt;15&lt;span style="color: gray"&gt;, &lt;/span&gt;@on&lt;br /&gt;&lt;span style="color: blue"&gt;exec &lt;/span&gt;&lt;span style="color: maroon"&gt;sp_trace_setevent &lt;/span&gt;@TraceID&lt;span style="color: gray"&gt;, &lt;/span&gt;137&lt;span style="color: gray"&gt;, &lt;/span&gt;1&lt;span style="color: gray"&gt;, &lt;/span&gt;@on&lt;br /&gt;&lt;span style="color: blue"&gt;exec &lt;/span&gt;&lt;span style="color: maroon"&gt;sp_trace_setevent &lt;/span&gt;@TraceID&lt;span style="color: gray"&gt;, &lt;/span&gt;137&lt;span style="color: gray"&gt;, &lt;/span&gt;13&lt;span style="color: gray"&gt;, &lt;/span&gt;@on&lt;br /&gt; &lt;br /&gt;&lt;span style="color: green"&gt;-- Set the Filters&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;declare &lt;/span&gt;@intfilter &lt;span style="color: blue"&gt;int&lt;br /&gt;declare &lt;/span&gt;@bigintfilter &lt;span style="color: blue"&gt;bigint&lt;br /&gt;&lt;/span&gt;&lt;span style="color: green"&gt;-- Set the trace status to start&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;exec &lt;/span&gt;&lt;span style="color: maroon"&gt;sp_trace_setstatus &lt;/span&gt;@TraceID&lt;span style="color: gray"&gt;, &lt;/span&gt;1&lt;br /&gt;&lt;span style="color: green"&gt;-- display trace id for future references&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;select &lt;/span&gt;TraceID&lt;span style="color: gray"&gt;=&lt;/span&gt;@TraceID&lt;br /&gt;&lt;span style="color: blue"&gt;goto &lt;/span&gt;finish&lt;br /&gt;&lt;span style="color: blue"&gt;error: &lt;br /&gt;select &lt;/span&gt;ErrorCode&lt;span style="color: gray"&gt;=&lt;/span&gt;@rc&lt;br /&gt;&lt;span style="color: blue"&gt;finish: &lt;br /&gt;go&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Make note of the TraceID that is output from running the above script.&amp;#160; Also not every SQL Server Service account can write to the root of the C drive.&amp;#160; None of my production servers can, but I am building this demo on my laptop where it can.&amp;#160; Make sure that a correct path is specified for the trace file.&amp;#160; Most servers will output traceid = 2 for this since there is the default trace running in SQL Server 2005.&amp;#160; Keep this number because it is needed to stop and delete the trace later on.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Now that the trace is active, to test it and demonstrate the blocked process report output open a new SSMS query window and run the following script:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;use &lt;/span&gt;tempdb&lt;br /&gt;&lt;span style="color: blue"&gt;create table &lt;/span&gt;temp1&lt;br /&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;rowid &lt;span style="color: blue"&gt;int&lt;/span&gt;&lt;span style="color: gray"&gt;)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;insert into &lt;/span&gt;temp1 &lt;span style="color: blue"&gt;values &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;1&lt;span style="color: gray"&gt;)&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Then open another new query window and run the following script:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;begin tran&lt;br /&gt;update &lt;/span&gt;temp1&lt;br /&gt;&lt;span style="color: blue"&gt;set &lt;/span&gt;rowid &lt;span style="color: gray"&gt;= &lt;/span&gt;rowid &lt;span style="color: gray"&gt;+ &lt;/span&gt;1&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;This will leave an open blocking transaction against the temp1 table in tempdb.&amp;#160; Now open another (my this is a lot of windows isn't it) query window and run the following script:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;select &lt;/span&gt;&lt;span style="color: gray"&gt;* &lt;/span&gt;&lt;span style="color: blue"&gt;from &lt;/span&gt;temp1&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Let it sit for about 10-20 seconds, and then kill the execution and close the query window.&amp;#160; Then rollback the transaction in the update query window and close that window as well (see I am cleaning up as we go).&amp;#160; The run the following query to clean up the rest of the example:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;drop table &lt;/span&gt;temp1&lt;br /&gt;&lt;span style="color: green"&gt;--stop the trace&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;exec &lt;/span&gt;&lt;span style="color: maroon"&gt;sp_trace_setstatus &lt;/span&gt;2&lt;span style="color: gray"&gt;, &lt;/span&gt;0&lt;br /&gt;&lt;span style="color: green"&gt;--delete the trace but leaves the file on the drive&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;exec &lt;/span&gt;&lt;span style="color: maroon"&gt;sp_trace_setstatus &lt;/span&gt;2&lt;span style="color: gray"&gt;, &lt;/span&gt;2&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Now to look at the output in the trace file run the following query:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;select &lt;/span&gt;&lt;span style="color: magenta"&gt;cast&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;TextData &lt;span style="color: blue"&gt;as xml&lt;/span&gt;&lt;span style="color: gray"&gt;), &lt;/span&gt;SPID&lt;span style="color: gray"&gt;, &lt;/span&gt;EndTime&lt;span style="color: gray"&gt;, &lt;/span&gt;Duration&lt;span style="color: gray"&gt;/&lt;/span&gt;1000&lt;span style="color: gray"&gt;/&lt;/span&gt;1000&lt;br /&gt;&lt;span style="color: blue"&gt;from &lt;/span&gt;&lt;span style="color: green"&gt;fn_trace_gettable&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: red"&gt;N'c:\BlockedProcessTrace.trc'&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: blue"&gt;default&lt;/span&gt;&lt;span style="color: gray"&gt;)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;where &lt;/span&gt;eventclass &lt;span style="color: gray"&gt;= &lt;/span&gt;137&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;By casting the TextData to an xml datatype you can click on it and have it open up formatted in SSMS.&amp;#160; The output will be similar to the following:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;blocked-process-report &lt;/span&gt;&lt;span style="color: red"&gt;monitorLoop&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;160986&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;blocked-process&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;process &lt;/span&gt;&lt;span style="color: red"&gt;id&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;process929d38&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;taskpriority&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;0&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;logused&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;0&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;waitresource&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;RID: 2:1:480:0&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;waittime&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;17953&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;ownerId&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;123106201&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;transactionname&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;SELECT&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;lasttranstarted&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;2008-09-24T16:39:38.620&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;XDES&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;0x9bc3920&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;lockMode&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;S&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;schedulerid&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;2&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;kpid&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;2064&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;status&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;suspended&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;spid&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;145&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;sbid&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;0&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;ecid&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;0&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;priority&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;0&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;transcount&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;0&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;lastbatchstarted&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;2008-09-24T16:39:38.620&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;lastbatchcompleted&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;2008-09-24T16:39:10.667&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;clientapp&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Microsoft SQL Server Management Studio - Query&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;hostname&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;SQLDEMO&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;hostpid&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;4944&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;loginname&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;SQLDEMO\DemoUser&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;isolationlevel&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;read committed (2)&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;xactid&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;123106201&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;currentdb&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;2&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;lockTimeout&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;4294967295&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;clientoption1&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;671090784&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;clientoption2&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;390200&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;executionStack&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;frame &lt;/span&gt;&lt;span style="color: red"&gt;line&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;1&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;sqlhandle&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;0x0200000088baad31046d031f04c8e7293882ce42521d893f&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;&lt;br /&gt;      &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;executionStack&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;inputbuf&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;select * from temp1   &lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;inputbuf&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;process&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;blocked-process&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;blocking-process&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;process &lt;/span&gt;&lt;span style="color: red"&gt;status&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;sleeping&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;spid&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;78&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;sbid&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;0&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;ecid&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;0&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;priority&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;0&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;transcount&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;1&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;lastbatchstarted&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;2008-09-24T16:39:37.060&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;lastbatchcompleted&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;2008-09-24T16:39:47.057&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;clientapp&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Microsoft SQL Server Management Studio - Query&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;hostname&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;SQLDEMO&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;hostpid&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;4944&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;loginname&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;SQLDEMO\DemoUser&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;isolationlevel&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;read committed (2)&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;xactid&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;123105638&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;currentdb&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;2&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;lockTimeout&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;4294967295&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;clientoption1&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;671090784&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;clientoption2&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;390200&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;executionStack &lt;/span&gt;&lt;span style="color: blue"&gt;/&amp;gt;&lt;br /&gt;      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;inputbuf&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;begin tran&lt;br /&gt;update temp1&lt;br /&gt;set rowid = rowid + 1&lt;br /&gt;&lt;br /&gt;waitfor delay '00:00:10'   &lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;inputbuf&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;process&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;blocking-process&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;blocked-process-report&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;From this, you can see what is blocked as well as what is blocking.&amp;#160; Begin looking at the blocking process to determine why it is blocking.&amp;#160; If you can solve that problem then the issue goes away.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Hope it helps.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-2044681107470696677?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/2044681107470696677/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/09/monitoring-for-blocked-processes-on-sql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2044681107470696677'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2044681107470696677'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/09/monitoring-for-blocked-processes-on-sql.html' title='Monitoring for Blocked Processes On SQL 2005 - Extended Version'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-4732442566356470132</id><published>2008-09-24T10:36:00.001-04:00</published><updated>2008-09-24T10:36:20.872-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><category scheme='http://www.blogger.com/atom/ns#' term='Certification'/><title type='text'>Beta SQL Server 2008 Exams Free Certification</title><content type='html'>&lt;p&gt;I am a bit behind on this one, but I just learned that the SQL 2008 MCTS Developer exam is available for Beta and its free.&amp;#160; Read the following blog posting:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.technet.com/betaexams/archive/2008/09/17/register-for-beta-exam-71-433-microsoft-sql-server-2008-database-development-beginning-september-19-2008.aspx"&gt;Register for Beta Exam 71-433: TS: Microsoft SQL Server 2008, Database Development - Beginning September 19, 2008&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.technet.com/betaexams/archive/2008/08/26/register-for-beta-exam-71-451-pro-microsoft-sql-server-2008-designing-and-optimizing-database-solutions-beginning-august-29th-2008.aspx"&gt;Register for Beta Exam 71-451: PRO: Microsoft SQL Server 2008, Designing and Optimizing Database Solutions &amp;#8211; Beginning August 29th, 2008&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;I also added this blog to my blog reader so I am not behind on this kind of stuff in the future.&amp;#160; Free sounds good to me.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-4732442566356470132?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/4732442566356470132/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/09/beta-sql-server-2008-exams-free.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/4732442566356470132'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/4732442566356470132'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/09/beta-sql-server-2008-exams-free.html' title='Beta SQL Server 2008 Exams Free Certification'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-7614017691086092896</id><published>2008-09-23T10:39:00.001-04:00</published><updated>2008-09-23T10:39:07.778-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2008'/><title type='text'>SQL Server 2008 Cumulative Update 1 Release</title><content type='html'>&lt;p&gt;Following the new servicing model, SQL Server 2008 CU1 has been released by Microsoft:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://support.microsoft.com/kb/956717/" href="http://support.microsoft.com/kb/956717/"&gt;http://support.microsoft.com/kb/956717/&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-7614017691086092896?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/7614017691086092896/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/09/sql-server-2008-cumulative-update-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/7614017691086092896'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/7614017691086092896'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/09/sql-server-2008-cumulative-update-1.html' title='SQL Server 2008 Cumulative Update 1 Release'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-1458673177398602460</id><published>2008-09-15T11:14:00.001-04:00</published><updated>2008-09-15T11:14:01.889-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Security'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>New Virus targeting SQL Servers</title><content type='html'>&lt;p&gt;A post on the forums about a job that existed that was questionable turned out to be a relatively new virus that is targetted at SQL Server.&amp;#160; If you follow best practice security implementation of SQL, then there is nothing to worry about.&amp;#160; You can read about this virus on the symantec website:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.symantec.com/security_response/writeup.jsp?docid=2008-091215-0809-99" href="http://www.symantec.com/security_response/writeup.jsp?docid=2008-091215-0809-99"&gt;http://www.symantec.com/security_response/writeup.jsp?docid=2008-091215-0809-99&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-1458673177398602460?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/1458673177398602460/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/09/new-virus-targeting-sql-servers.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/1458673177398602460'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/1458673177398602460'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/09/new-virus-targeting-sql-servers.html' title='New Virus targeting SQL Servers'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-5134910806681693288</id><published>2008-09-14T23:08:00.001-04:00</published><updated>2008-09-14T23:08:54.662-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Query Processing'/><category scheme='http://www.blogger.com/atom/ns#' term='TSQL'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>SQL Server Views and Performance</title><content type='html'>&lt;p&gt;Someone asked me recently how do views affect performance in SQL Server, since they don't get a compiled execution plan like a stored procedure?&amp;#160; In investigating this, I was at first surprised to find that the person asking was absolutely correct, there is no compiled plan for a view in the dmv's:&lt;/p&gt;  &lt;blockquote&gt;   &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;select &lt;/span&gt;usecounts&lt;span style="color: gray"&gt;,&lt;/span&gt;cacheobjtype&lt;span style="color: gray"&gt;,&lt;/span&gt;objtype&lt;span style="color: gray"&gt;,&lt;/span&gt;query&lt;span style="color: gray"&gt;.&lt;/span&gt;text&lt;span style="color: gray"&gt;,&lt;/span&gt;executionplan&lt;span style="color: gray"&gt;.&lt;/span&gt;query_plan &lt;br /&gt;&lt;span style="color: blue"&gt;from &lt;/span&gt;&lt;span style="color: green"&gt;sys.dm_exec_cached_plans &lt;br /&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;cross apply &lt;/span&gt;sys.dm_exec_sql_text&lt;span style="color: gray"&gt;(&lt;/span&gt;plan_handle&lt;span style="color: gray"&gt;) &lt;/span&gt;&lt;span style="color: blue"&gt;as &lt;/span&gt;query&lt;br /&gt;&lt;span style="color: gray"&gt;cross apply &lt;/span&gt;sys.dm_exec_query_plan&lt;span style="color: gray"&gt;(&lt;/span&gt;plan_handle&lt;span style="color: gray"&gt;) &lt;/span&gt;&lt;span style="color: blue"&gt;as &lt;/span&gt;executionplan &lt;br /&gt;&lt;span style="color: blue"&gt;where text &lt;/span&gt;&lt;span style="color: gray"&gt;not like &lt;/span&gt;&lt;span style="color: red"&gt;'%sys%'&lt;/span&gt;&lt;span style="color: gray"&gt;and &lt;/span&gt;cacheobjtype &lt;span style="color: gray"&gt;=&lt;/span&gt;&lt;span style="color: red"&gt;'compiled plan' &lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;If you run the above, you will find that Views get a Parse Tree instead.&amp;#160; So what does this mean exactly in the context of performance and using a view?&amp;#160; The answer is not really all that simple.&amp;#160; The Parse Tree defines the expansion of the view definition for execution time.&amp;#160; While the actual view doesn't have a compiled plan, the queries that use the view do.&amp;#160; You can test this by clearing the procedure cache:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;DBCC &lt;/span&gt;FREEPROCCACHE&lt;/pre&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;and then running a query, twice with different parameter values, with a view in your database:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;SELECT &lt;/span&gt;&lt;span style="color: gray"&gt;* &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;[dbo]&lt;span style="color: gray"&gt;.&lt;/span&gt;[SampleView]&lt;br /&gt;&lt;span style="color: blue"&gt;WHERE &lt;/span&gt;OrderID &lt;span style="color: gray"&gt;= &lt;/span&gt;10248&lt;br /&gt; &lt;br /&gt;&lt;span style="color: blue"&gt;SELECT &lt;/span&gt;&lt;span style="color: gray"&gt;* &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;[dbo]&lt;span style="color: gray"&gt;.&lt;/span&gt;[SampleView]&lt;br /&gt;&lt;span style="color: blue"&gt;WHERE &lt;/span&gt;OrderID &lt;span style="color: gray"&gt;= &lt;/span&gt;10250&lt;/pre&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;If you look at the cache now, you should see that this query was parameterized by the SQL Server, and stored in the plan cache for reuse.&amp;#160; This means that your index tuning for a system that heavily uses Views that join multiple tables, must be based, not on the view definition itself but instead on the code that utilizes the view.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-5134910806681693288?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/5134910806681693288/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/09/sql-server-views-and-performance.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/5134910806681693288'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/5134910806681693288'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/09/sql-server-views-and-performance.html' title='SQL Server Views and Performance'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-2167751643584590618</id><published>2008-09-09T09:55:00.001-04:00</published><updated>2008-09-09T09:55:05.743-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>SQL Server Developer Factsheet</title><content type='html'>&lt;p&gt;I love quick references, especially when they contain 90% of the common things that I have to double check in the BOL because I am not a walking desk reference on TSQL.&amp;#160; A really nice one that was provided in a post on the forums is available as a free pdf to download.&amp;#160; It is a very good reference that I would recommend printing and putting up on the wall of your desk/cube.&lt;/p&gt;  &lt;p&gt;&lt;a title="Download the SQL Server factsheet" href="http://www.dotnet4all.com/snippets/factsheet%20SQL%20Server.pdf"&gt;Download the SQL Server factsheet&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-2167751643584590618?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/2167751643584590618/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/09/sql-server-developer-factsheet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2167751643584590618'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2167751643584590618'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/09/sql-server-developer-factsheet.html' title='SQL Server Developer Factsheet'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-2986158394903590959</id><published>2008-09-08T19:18:00.001-04:00</published><updated>2008-09-08T19:18:08.644-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>Where did professional decency go?  Especially amongst what is supposed to be some of our top minds?</title><content type='html'>&lt;p&gt;I am not sure the chain of events that lead me to a blog that referenced this post on the Google groups, but it really is a sad thing when I read it:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://groups.google.co.uk/group/microsoft.public.sqlserver.programming/browse_frm/thread/bf9e20ea9299598c/97465f4a1b604410?lnk=st&amp;amp;q=%22--celko&amp;amp;rnum=7&amp;amp;hl=en#" target="_blank"&gt;Really Sad Post&lt;/a&gt;&lt;a title="http://groups.google.co.uk/group/microsoft.public.sqlserver.programming/browse_frm/thread/bf9e20ea9299598c/97465f4a1b604410?lnk=st&amp;amp;q=%22--celko&amp;amp;rnum=7&amp;amp;hl=en#" href="http://groups.google.co.uk/group/microsoft.public.sqlserver.programming/browse_frm/thread/bf9e20ea9299598c/97465f4a1b604410?lnk=st&amp;amp;q=%22--celko&amp;amp;rnum=7&amp;amp;hl=en#"&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;When I started answering posts on the Forums earlier this year, I almost fell into this kind of diatribe once.&amp;#160; It really bothers me to see that MVP's would go about trashing one another in this form publicly on a post where someone was seeking assistance.&amp;#160; The MSDN Forums are not exempt from this kind of behavior, but they are monitored by Moderators and Answerers and problems are headed off early by removing inflammatory posts, or locking the thread.&amp;#160; It is really easy to become overbearing and arrogant and today it seems to be becoming more prevalent.&amp;#160; &lt;/p&gt;  &lt;p&gt;One of the things I have tried to do the more I have learned, and as I have gained recognition in the SQL Server community at large is to remain humble and try to be a mentor rather than a critic.&amp;#160; There once was a time when I didn't know that null values added with non-null values would result in a null value.&amp;#160; If you happen to actually read my blog, then I implore you to keep in mind that there was once a time when you didn't know how to do the basics either.&amp;#160; If you choose to answer a question online, remember it was your choice, and the person is looking for help, not condescension or criticism, and if all you have to offer is one of the two, then please exercise the choose not to answer.&amp;#160; It is really that simple.&lt;/p&gt;  &lt;p&gt;If you do answer, remember that in most cases, the Internet is forever.&amp;#160; Stuff never disappears completely, so formulate your answer in a manner that if someone else finds it, it is general enough or detailed enough that they get the answer too.&amp;#160; I have a number of posts that I wrote over the last year, that I now use as simple reference posts.&amp;#160; I also have posts marked that others wrote that were excellent write-ups and instead of rebuilding the answer, I'll post a reference to what already exists. &lt;/p&gt;  &lt;p&gt;Now that I have that all said, I'll get off my soap box and go back to the regularly scheduled programming.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-2986158394903590959?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/2986158394903590959/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/09/where-did-professional-decency-go.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2986158394903590959'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2986158394903590959'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/09/where-did-professional-decency-go.html' title='Where did professional decency go?  Especially amongst what is supposed to be some of our top minds?'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-2719068759470359167</id><published>2008-09-05T22:44:00.001-04:00</published><updated>2008-09-05T22:44:08.953-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Query Processing'/><category scheme='http://www.blogger.com/atom/ns#' term='MSDN Forums'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>DayofWeek functions differently between SQL Servers?</title><content type='html'>&lt;p&gt;A &lt;a href="http://forums.microsoft.com/Forums/ShowPost.aspx?PostID=3828370&amp;amp;SiteID=1"&gt;question this week on the forums&lt;/a&gt; that might be of interest involved a stored procedure having different results for the following query:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;SELECT &lt;/span&gt;&lt;span style="color: magenta"&gt;GETDATE&lt;/span&gt;&lt;span style="color: gray"&gt;() &lt;/span&gt;&lt;span style="color: red"&gt;'Today'&lt;br /&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;,&lt;/span&gt;&lt;span style="color: magenta"&gt;convert&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: blue"&gt;char&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;1&lt;span style="color: gray"&gt;),&lt;/span&gt;&lt;span style="color: magenta"&gt;DATEPART&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: blue"&gt;weekday&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: magenta"&gt;GETDATE&lt;/span&gt;&lt;span style="color: gray"&gt;()+&lt;/span&gt;6&lt;span style="color: gray"&gt;)) &lt;/span&gt;&lt;span style="color: blue"&gt;AS &lt;/span&gt;&lt;span style="color: red"&gt;'InDay_No'&lt;br /&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;,&lt;/span&gt;&lt;span style="color: magenta"&gt;DATENAME&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;DW&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: magenta"&gt;GETDATE&lt;/span&gt;&lt;span style="color: gray"&gt;()+&lt;/span&gt;6&lt;span style="color: gray"&gt;) &lt;/span&gt;&lt;span style="color: blue"&gt;AS &lt;/span&gt;&lt;span style="color: red"&gt;'InDay_Name'&lt;br /&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;,&lt;/span&gt;&lt;span style="color: magenta"&gt;convert&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: blue"&gt;char&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;1&lt;span style="color: gray"&gt;),&lt;/span&gt;&lt;span style="color: magenta"&gt;DATEPART&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;&lt;span style="color: blue"&gt;weekday&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: magenta"&gt;GETDATE&lt;/span&gt;&lt;span style="color: gray"&gt;()+&lt;/span&gt;2&lt;span style="color: gray"&gt;)) &lt;/span&gt;&lt;span style="color: blue"&gt;AS &lt;/span&gt;&lt;span style="color: red"&gt;'OutDay_No'&lt;br /&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;,&lt;/span&gt;&lt;span style="color: magenta"&gt;DATENAME&lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;/span&gt;DW&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: magenta"&gt;GETDATE&lt;/span&gt;&lt;span style="color: gray"&gt;()+&lt;/span&gt;2&lt;span style="color: gray"&gt;) &lt;/span&gt;&lt;span style="color: blue"&gt;AS &lt;/span&gt;&lt;span style="color: red"&gt;'OutDay_Name'&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: red"&gt;&lt;font face="Verdana" color="#333333"&gt;On one server the output for the day number was 2 for Tuesday while on another server it was 3.  This was caused by different default language settings for the login on the servers.  The @@Datefirst parameter will show the difference in configuration, and changing the default language resolves the problem.&lt;/font&gt;&lt;/span&gt;&lt;/pre&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-2719068759470359167?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/2719068759470359167/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/09/dayofweek-functions-differently-between.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2719068759470359167'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2719068759470359167'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/09/dayofweek-functions-differently-between.html' title='DayofWeek functions differently between SQL Servers?'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-1394180105517112668</id><published>2008-09-04T00:01:00.001-04:00</published><updated>2008-09-04T00:01:30.621-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='Extended Events'/><title type='text'>SQL Server 2008 Extended Events Manager Build 1.0.1.89</title><content type='html'>&lt;p&gt;I moved the project from the &lt;a href="http://code.msdn.microsoft.com/ExtendedEventManager"&gt;http://code.msdn.microsoft.com/ExtendedEventManager&lt;/a&gt; site to &lt;a href="http://www.codeplex.com/ExtendedEventManager/"&gt;http://www.codeplex.com/ExtendedEventManager/&lt;/a&gt; since this was the release point defined in the SQL Heros contest and I had originally planned to enter this into that contest when I realized that it was running through Sept 1, 2008.&lt;/p&gt;  &lt;p&gt;Included in this release is an updated Documentation file, and fixes to all bugs that have been found to date.&amp;#160; This should be a very stable release, and pending any major problems will be the last release until I have the StandAlone library completed and coded with Unit Tests for use with PowerShell and or inside other applications.&lt;/p&gt;  &lt;p&gt;This has definately been a long learning experience building.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-1394180105517112668?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/1394180105517112668/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/09/sql-server-2008-extended-events-manager.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/1394180105517112668'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/1394180105517112668'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/09/sql-server-2008-extended-events-manager.html' title='SQL Server 2008 Extended Events Manager Build 1.0.1.89'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-793361744926339375</id><published>2008-08-28T20:19:00.001-04:00</published><updated>2008-08-28T20:19:56.349-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='Extended Events'/><title type='text'>SQL 2008 Extended Events Manager Build 1.0.1.38</title><content type='html'>&lt;p&gt;I uploaded a newer version of the app I have been working on tonight.&amp;#160; It now has the ability to create/edit/drop Event Sessions by script.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-793361744926339375?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/793361744926339375/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/08/sql-2008-extended-events-manager-build.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/793361744926339375'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/793361744926339375'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/08/sql-2008-extended-events-manager-build.html' title='SQL 2008 Extended Events Manager Build 1.0.1.38'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-6229847587438882028</id><published>2008-08-25T10:10:00.001-04:00</published><updated>2008-08-25T10:10:08.297-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='Extended Events'/><title type='text'>Extended Events Manager - Build 1.0.0.12 (Released)</title><content type='html'>&lt;p&gt;For a few weeks I have been focused on Extended Events and how they work in SQL 2008.&amp;#160; One of things missing for the Extended Events is UI support.&amp;#160; In fact there isn't even a SMO namespace for Extended Events as of the RTM of SQL 2008.&amp;#160; This makes using Extended Events fairly complex, and requires that you have a firm understanding of the architecture and Metadata for the packages available.&lt;/p&gt;  &lt;p&gt;To simplify this, I have written a C#.NET winforms application that can be used to help manage/explore extended events in SQL 2008.&amp;#160; I posted the source as well as compiled binaries for the first release on the MSDN code gallery as an opensource project.&amp;#160; I am sure that the code is not in keeping with design patterns or best practices, but I am not a C# developer, I am a DBA.&amp;#160; I welcome any comments or advice on this:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://code.msdn.microsoft.com/ExtendedEventManager/" href="http://code.msdn.microsoft.com/ExtendedEventManager/"&gt;http://code.msdn.microsoft.com/ExtendedEventManager/&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-6229847587438882028?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/6229847587438882028/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/08/extended-events-manager-build-10012.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/6229847587438882028'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/6229847587438882028'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/08/extended-events-manager-build-10012.html' title='Extended Events Manager - Build 1.0.0.12 (Released)'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-6557816080652340997</id><published>2008-08-20T14:37:00.001-04:00</published><updated>2008-08-20T14:37:38.632-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSMS'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2008'/><title type='text'>SQL 2008 SSMS - What happened to F8 = Open Object Explorer</title><content type='html'>&lt;p&gt;A online friend and fellow moderator from the forums, &lt;a href="http://deepakrangarajan.blogspot.com"&gt;Deepak Rangarajan&lt;/a&gt;, asked a good question this morning in a chat that is worthy of blogging about.&amp;#160; In SQL Management Studio 2005 you could hit the F8 key as a shortcut to bring up the Object Explorer.&amp;#160; I personally didn't know this until today, but out of the box SSMS 2008 doesn't do this.&amp;#160; Since I started in SQL 2000 using the old Query Analyzer, I know the old hot keys for doing things like Ctl+Shft+C will comment out the current highlighted code block, and Ctl+Shft+R will uncomment it.&amp;#160; This was not available with the default keyboard configuration in SSMS 2005, but you can change the Keyboard to the SQL 2000 settings in Tools-&amp;gt;Options and it will work as it did in Query Analyzer.&amp;#160; Naturally this was one of the first changes I made in SSMS 2008 when I installed it, but this also brings the F8 shortcut functionality back.&amp;#160; &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-6557816080652340997?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/6557816080652340997/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/08/sql-2008-ssms-what-happened-to-f8-open.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/6557816080652340997'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/6557816080652340997'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/08/sql-2008-ssms-what-happened-to-f8-open.html' title='SQL 2008 SSMS - What happened to F8 = Open Object Explorer'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-3197298990328824928</id><published>2008-08-20T14:27:00.001-04:00</published><updated>2008-08-20T14:27:36.716-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2008'/><title type='text'>SQL 2008 Filestream and Attach Database</title><content type='html'>&lt;p&gt;If when you upgrade to SQL Server 2008 you decide to use the Filestream feature, you can not detach a database, move the files and attach the database back to SQL Server with as much ease as you previously used to do.&amp;#160; In order to move the filestream binaries, and the database data and log files to a new location, you have to use the CREATE DATABASE command and specify the FOR ATTACH option:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;CREATE DATABASE &lt;/span&gt;Archive &lt;br /&gt;&lt;span style="color: blue"&gt;ON&lt;br /&gt;PRIMARY &lt;/span&gt;&lt;span style="color: gray"&gt;( &lt;/span&gt;NAME &lt;span style="color: gray"&gt;= &lt;/span&gt;Arch1&lt;span style="color: gray"&gt;,&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: blue"&gt;FILENAME &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;&lt;span style="color: red"&gt;N'D:\Srvapps\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\archdat1.mdf'&lt;/span&gt;&lt;span style="color: gray"&gt;),&lt;br /&gt;&lt;/span&gt;FILEGROUP FileStreamGroup1 &lt;span style="color: blue"&gt;CONTAINS FILESTREAM&lt;/span&gt;&lt;span style="color: gray"&gt;( &lt;/span&gt;NAME &lt;span style="color: gray"&gt;= &lt;/span&gt;Arch3&lt;span style="color: gray"&gt;,&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: blue"&gt;FILENAME &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;&lt;span style="color: red"&gt;N'D:\Srvapps\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\filestream1'&lt;/span&gt;&lt;span style="color: gray"&gt;)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: magenta"&gt;LOG &lt;/span&gt;&lt;span style="color: blue"&gt;ON  &lt;/span&gt;&lt;span style="color: gray"&gt;( &lt;/span&gt;NAME &lt;span style="color: gray"&gt;= &lt;/span&gt;Archlog1&lt;span style="color: gray"&gt;,&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: blue"&gt;FILENAME &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;&lt;span style="color: red"&gt;N'D:\Srvapps\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\archlog1.ldf'&lt;/span&gt;&lt;span style="color: gray"&gt;)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;GO&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;If you create the above database, specifying the appropriate paths for your environment, and then detach the database from the SQL Instance, you can move the files, so the mdf, ldf, and filestream1 folder will be moved to the D:\Data\ directory.&amp;#160; To attach the database back from this new path, you can not use SSMS.&amp;#160; It is not aware of the Filestream filegroup, so you have to issue a DDL CREATE DATABASE command:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;USE &lt;/span&gt;[master]&lt;br /&gt;&lt;span style="color: blue"&gt;GO&lt;br /&gt;CREATE DATABASE &lt;/span&gt;[Archive] &lt;span style="color: blue"&gt;ON &lt;br /&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;( &lt;/span&gt;&lt;span style="color: blue"&gt;FILENAME &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;&lt;span style="color: red"&gt;N'D:\Data\archdat1.mdf' &lt;/span&gt;&lt;span style="color: gray"&gt;),&lt;br /&gt;( &lt;/span&gt;&lt;span style="color: blue"&gt;FILENAME &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;&lt;span style="color: red"&gt;N'D:\Data\archlog1.ldf' &lt;/span&gt;&lt;span style="color: gray"&gt;),&lt;br /&gt;( &lt;/span&gt;&lt;span style="color: blue"&gt;FILENAME &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;&lt;span style="color: red"&gt;N'D:\Data\filestream1' &lt;/span&gt;&lt;span style="color: gray"&gt;)&lt;br /&gt; &lt;/span&gt;&lt;span style="color: blue"&gt;FOR ATTACH&lt;br /&gt;GO&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;This will attach the database and update the system catalogs to reflect the new file locations properly.  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-3197298990328824928?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/3197298990328824928/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/08/sql-2008-filestream-and-attach-database.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/3197298990328824928'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/3197298990328824928'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/08/sql-2008-filestream-and-attach-database.html' title='SQL 2008 Filestream and Attach Database'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-6417514672482797071</id><published>2008-08-19T16:50:00.000-04:00</published><updated>2008-08-20T22:51:12.819-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='Extended Events'/><category scheme='http://www.blogger.com/atom/ns#' term='Database Audits'/><title type='text'>Suggestion for Extended Events</title><content type='html'>&lt;p&gt;As you can probably tell, I have been completely focused on Extended Events and learning/documenting how to use them for the last few weeks.&amp;#160; One thing I noticed is that the new Audit functionality in SQL 2008 actually runs on the Extended Events Engine.&amp;#160; This morning a friend chatted me by IM and asked about sp_rename and how the Audit catches it.&amp;#160; It is actually picked up by the Audit as an ALTER of the object.&amp;#160; However, they also needed to know the HostName that originated the request, which is not available in the Audit.&amp;#160; This is because it is also not available as an Action in Extended Events.&amp;#160; This would be a valuable piece of information to have and I have filed this as a suggestion with the SQL Server connect site:&lt;/p&gt;  &lt;p&gt;&lt;a href="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=362471"&gt;SQL 2008 Extended Events Addition&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;There is however, a workaround that I provided my friend.&amp;#160; You can create a DDL LOGON trigger that uses the session_id to get the HostName if it exists from the sys.dm_exec_sessions DMV and store it to an Audit table.&amp;#160; Then you can correlate the Audit Event Time, and session_id with the Audit tables Session_id and event time for the Logon to know what HostName was logged onto the Session_ID.&amp;#160; Kind of a hack work around but it will get the job done.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-6417514672482797071?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/6417514672482797071/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/08/suggestion-for-extended-events.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/6417514672482797071'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/6417514672482797071'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/08/suggestion-for-extended-events.html' title='Suggestion for Extended Events'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-2477000077528500210</id><published>2008-08-14T21:41:00.000-04:00</published><updated>2008-08-20T22:43:25.809-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='Extended Events'/><title type='text'>Extended Events and Errors in the BOL</title><content type='html'>&lt;p&gt;I have been working since the RTM release of SQL Server 2008 with the Extended Events, which are a powerful tool to assist Administrators in troubleshooting problems.&amp;#160; That is, if you can actually get an understanding of how to use them from the little information that actually exists currently (not to worry, I am doing a lot of heavy documentation as I go, and will publish it in the coming weeks).&amp;#160; To compound the issue, the Books Online haven't been maintained from CTP to CTP or even through the RC0 to RTM, and contain numerous errors in them.&amp;#160; I filed a few connect items already:&lt;/p&gt;  &lt;p&gt;&lt;a title="Errors in the BOL for SQL 2008 DMV sys.dm_xe_map_values" href="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=361853"&gt;Errors in the BOL for SQL 2008 DMV sys.dm_xe_map_values&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="Errors in the BOL for SQL 2008 DMV sys.dm_xe_map_values" href="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=361854"&gt;Errors in the BOL for SQL 2008 DMV sys.dm_xe_objects&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;I goofed on the title for the second one, but I can't figure out how to update it at this point.&amp;#160; I will keep this post updated with other bugs I file as I find them.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-2477000077528500210?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/2477000077528500210/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/08/extended-events-and-errors-in-bol.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2477000077528500210'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2477000077528500210'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/08/extended-events-and-errors-in-bol.html' title='Extended Events and Errors in the BOL'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-8401022841511770538</id><published>2008-08-12T12:13:00.000-04:00</published><updated>2008-10-07T21:00:20.647-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DBA Tutorials'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='Best Practices'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>How to tell if you have Instant File Initialization Enabled</title><content type='html'>&lt;p&gt;I subscribe to a number of great blogs, and Paul Randal's is one of my favorites.&amp;#160; As a previous member of the SQL Development team at Microsoft, and the writer of such wonderful tools as CHECKDB, his knowledge of the storage engine is amazing at times.&amp;#160; I don't really like to cross post blogs like this usually, but Paul has a great post for validating that you have Instant File Initialization Enabled:&lt;/p&gt;  &lt;h4&gt;&lt;a href="http://www.sqlskills.com/blogs/paul/2008/08/11/HowToTellIfYouHaveInstantInitializationEnabled.aspx"&gt;How to tell if you have instant initialization enabled?&lt;/a&gt;&lt;/h4&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-8401022841511770538?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/8401022841511770538/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/08/how-to-tell-if-you-have-instant-file.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/8401022841511770538'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/8401022841511770538'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/08/how-to-tell-if-you-have-instant-file.html' title='How to tell if you have Instant File Initialization Enabled'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-6956552999587313482</id><published>2008-08-11T15:03:00.001-04:00</published><updated>2008-08-11T15:03:46.500-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2008'/><title type='text'>SQL 2008 Intellisense, Only for SQL 2008</title><content type='html'>&lt;p&gt;I am playing with my RTM install of SQL 2008, the first server at work to be on the new version, and I realize that Intellisense isn't working.&amp;#160; Actually it is, just not for any server connection except the SQL 2008 one.&amp;#160; It seems as though Microsoft doesn't care based on the number of comments on the Connect site for numerous postings of this by the community.&amp;#160; The claim is that they are working on a new feature set, but with the ability of other tools like SQLPrompt to work for all versions of SQL it shouldn't seem far fetched to expect the same from an IDE that does intellisense for every other language it works with.&lt;/p&gt;  &lt;p&gt;I don't know that it will matter much since it is closed, but leave a feedback on this item if you care:&lt;/p&gt;  &lt;p&gt;&lt;a title="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=341872" href="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=341872"&gt;https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=341872&lt;/a&gt;&lt;a href="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=3418"&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-6956552999587313482?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/6956552999587313482/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/08/sql-2008-intellisense-only-for-sql-2008.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/6956552999587313482'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/6956552999587313482'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/08/sql-2008-intellisense-only-for-sql-2008.html' title='SQL 2008 Intellisense, Only for SQL 2008'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-20520104903056077</id><published>2008-08-06T16:25:00.001-04:00</published><updated>2008-08-06T16:33:04.158-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>SQL 2008 RTM</title><content type='html'>&lt;p&gt;Finally, it is here.&amp;#160; SQL 2008 was made RTM today:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.microsoft.com/Presspass/press/2008/aug08/08-06SQLServer2008PR.mspx" href="http://www.microsoft.com/Presspass/press/2008/aug08/08-06SQLServer2008PR.mspx"&gt;http://www.microsoft.com/Presspass/press/2008/aug08/08-06SQLServer2008PR.mspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;I am downloading the MSDN subscriber ISO right now to see what changes, if any, were made in the final cut.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-20520104903056077?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/20520104903056077/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/08/sql-2008-rtm.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/20520104903056077'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/20520104903056077'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/08/sql-2008-rtm.html' title='SQL 2008 RTM'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-2146202393743935503</id><published>2008-07-31T11:50:00.001-04:00</published><updated>2008-07-31T11:50:05.648-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Security'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA Tutorials'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2008'/><title type='text'>Granting Access to users to View System Data without Granting Access to System Objects.</title><content type='html'>&lt;p&gt;&lt;/p&gt;  &lt;p&gt;There are precious few scenarios where non-DBA's in my environment have any business looking at system tables.&amp;#160; However, I have seen questions on the forums where someone needs to allow a developer to select information off specific DMV's or system Views/Tables.&amp;#160; With SQL 2005, you can build wrapper stored procedures that execute under the context of the Database Owner Account.&amp;#160; In my environment this happens to be the sa user account for most databases.&amp;#160; So for a user to get information from sys.databases, you can create a stored procedure as follows:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;span style="color: blue"&gt;CREATE PROCEDURE &lt;/span&gt;uspGetDatabaseInfo       &lt;br /&gt;&lt;span style="color: blue"&gt;WITH EXECUTE AS OWNER        &lt;br /&gt;AS         &lt;br /&gt;BEGIN         &lt;br /&gt;SELECT &lt;/span&gt;&lt;span style="color: gray"&gt;* &lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;&lt;span style="color: green"&gt;sys.databases        &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;END        &lt;br /&gt;&lt;/span&gt;GO       &lt;br /&gt;      &lt;br /&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Then all you have to do is grant a user execute rights to this procedure.&amp;#160; They can't run a selects against the system table, but they can view the information inside of them.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-2146202393743935503?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/2146202393743935503/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/07/granting-access-to-users-to-view-system.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2146202393743935503'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2146202393743935503'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/07/granting-access-to-users-to-view-system.html' title='Granting Access to users to View System Data without Granting Access to System Objects.'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-8738471402325006031</id><published>2008-07-30T15:22:00.002-04:00</published><updated>2009-05-12T13:52:35.832-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Deadlocking'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA Tutorials'/><category scheme='http://www.blogger.com/atom/ns#' term='TSQL'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2005'/><title type='text'>The Anatomy of a Deadlock</title><content type='html'>This post has been moved to my new blog site.  You can find it at the following link:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://sqlblog.com/blogs/jonathan_kehayias/archive/2008/07/30/the-anatomy-of-a-deadlock.aspx"&gt;http://sqlblog.com/blogs/jonathan_kehayias/archive/2008/07/30/the-anatomy-of-a-deadlock.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-8738471402325006031?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://sqlblog.com/blogs/jonathan_kehayias/archive/2008/07/30/the-anatomy-of-a-deadlock.aspx' title='The Anatomy of a Deadlock'/><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/8738471402325006031/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/07/anatomy-of-deadlock.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/8738471402325006031'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/8738471402325006031'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/07/anatomy-of-deadlock.html' title='The Anatomy of a Deadlock'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-4672739583205861692</id><published>2008-07-29T13:12:00.001-04:00</published><updated>2008-07-29T13:12:21.690-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Query Processing'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA Tutorials'/><category scheme='http://www.blogger.com/atom/ns#' term='TSQL'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='Blocking'/><title type='text'>Identifying Blocked Processes with the Blocked Process Report</title><content type='html'>&lt;p&gt;If you have query delays from blocking, SQL Server has the Blocked Process Report that can generate as an XML document in Profiler, or as a WMI Alert which will provide the Blocked Spid and process information, as well as the blocking spid and process information.&amp;#160; However, before you can use this, you have to set a blocked process threshold to trigger the report.&amp;#160; By default it is set to 0 or off, but you can enable it with the following:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: maroon"&gt;sp_configure &lt;/span&gt;&lt;span style="color: red"&gt;'show advanced options'&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;1 &lt;span style="color: gray"&gt;;&lt;br /&gt;&lt;/span&gt;GO&lt;br /&gt;&lt;span style="color: blue"&gt;RECONFIGURE &lt;/span&gt;&lt;span style="color: gray"&gt;;&lt;br /&gt;&lt;/span&gt;GO&lt;br /&gt;&lt;span style="color: maroon"&gt;sp_configure &lt;/span&gt;&lt;span style="color: red"&gt;'blocked process threshold'&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;5 &lt;span style="color: gray"&gt;;&lt;br /&gt;&lt;/span&gt;GO&lt;br /&gt;&lt;span style="color: blue"&gt;RECONFIGURE &lt;/span&gt;&lt;span style="color: gray"&gt;;&lt;br /&gt;&lt;/span&gt;GO&lt;/pre&gt;&lt;br /&gt;By using this, you can set a trace for a single event and it will generate a report much like the output of deadlock trace flag 1205/1222.&amp;#160; In fact if you have ever read a deadlock graph from the ErrorLog for either of these trace flags, then the Blocked Process Report will seem really friendly.   &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-4672739583205861692?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/4672739583205861692/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/07/identifying-blocked-processes-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/4672739583205861692'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/4672739583205861692'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/07/identifying-blocked-processes-with.html' title='Identifying Blocked Processes with the Blocked Process Report'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-5640945075465534231</id><published>2008-07-28T13:37:00.001-04:00</published><updated>2008-07-28T13:37:58.795-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='TSQL'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><category scheme='http://www.blogger.com/atom/ns#' term='Database Audits'/><title type='text'>Difference between SQL 2000 and SQL 2005 system Views</title><content type='html'>&lt;p&gt;Part of my job is answering questions for internal and external audits.&amp;#160; Today one came in that made me have to break out some code and do some investigation.&amp;#160; One of the queries I provided had conflicting data with the results from another query.&amp;#160; Basically the first query said that there were objects owned by a database user, while the second said that the database user can't create objects.&amp;#160; This might seem trivial since it is possible that the user once had rights to create objects, only the objects were created since the last audit, and the user never had create rights on the database.&lt;/p&gt;  &lt;p&gt;The problem wasn't that the user created objects, it was that the queries being used were returning invalid information in SQL 2005 where they worked correctly in SQL 2000.&amp;#160; As a part of the upgrade to 2005, a new schema was created for DBA use in one of our databases where I copy tables (using SELECT * INTO DBA.TableName_DR_#### FROM TableName) before making changes to them in a Deployment Request, so that there is a rapid rollback point for changes being made in the event of a problem.&amp;#160; In SQL 2000 we would run code like the follow:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;SELECT &lt;/span&gt;sysobjects&lt;span style="color: gray"&gt;.&lt;/span&gt;name &lt;span style="color: blue"&gt;AS &lt;/span&gt;[object Name]&lt;span style="color: gray"&gt;, &lt;/span&gt;sysusers&lt;span style="color: gray"&gt;.&lt;/span&gt;name &lt;span style="color: blue"&gt;AS Owner&lt;/span&gt;&lt;span style="color: gray"&gt;, &lt;/span&gt;&lt;span style="color: blue"&gt;CASE &lt;br /&gt;WHEN &lt;/span&gt;sysobjects&lt;span style="color: gray"&gt;.&lt;/span&gt;xtype &lt;span style="color: gray"&gt;= &lt;/span&gt;&lt;span style="color: red"&gt;'S' &lt;/span&gt;&lt;span style="color: blue"&gt;THEN &lt;/span&gt;&lt;span style="color: red"&gt;'System Table' &lt;br /&gt;   &lt;/span&gt;&lt;span style="color: blue"&gt;WHEN &lt;/span&gt;sysobjects&lt;span style="color: gray"&gt;.&lt;/span&gt;xtype &lt;span style="color: gray"&gt;= &lt;/span&gt;&lt;span style="color: red"&gt;'P' &lt;/span&gt;&lt;span style="color: blue"&gt;THEN &lt;/span&gt;&lt;span style="color: red"&gt;'Stored Procedure' &lt;br /&gt;   &lt;/span&gt;&lt;span style="color: blue"&gt;WHEN &lt;/span&gt;sysobjects&lt;span style="color: gray"&gt;.&lt;/span&gt;xtype &lt;span style="color: gray"&gt;= &lt;/span&gt;&lt;span style="color: red"&gt;'U' &lt;/span&gt;&lt;span style="color: blue"&gt;THEN &lt;/span&gt;&lt;span style="color: red"&gt;'User Table' &lt;br /&gt;   &lt;/span&gt;&lt;span style="color: blue"&gt;END AS Type&lt;br /&gt;FROM &lt;/span&gt;sysobjects &lt;br /&gt;&lt;span style="color: gray"&gt;INNER JOIN &lt;/span&gt;sysusers &lt;span style="color: blue"&gt;ON &lt;/span&gt;sysobjects&lt;span style="color: gray"&gt;.&lt;/span&gt;uid &lt;span style="color: gray"&gt;= &lt;/span&gt;sysusers&lt;span style="color: gray"&gt;.&lt;/span&gt;uid&lt;br /&gt;&lt;span style="color: blue"&gt;Where &lt;/span&gt;sysobjects&lt;span style="color: gray"&gt;.&lt;/span&gt;xtype &lt;span style="color: gray"&gt;in (&lt;/span&gt;&lt;span style="color: red"&gt;'S'&lt;/span&gt;&lt;span style="color: gray"&gt;,&lt;/span&gt;&lt;span style="color: red"&gt;'P'&lt;/span&gt;&lt;span style="color: gray"&gt;,&lt;/span&gt;&lt;span style="color: red"&gt;'U'&lt;/span&gt;&lt;span style="color: gray"&gt;)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;Order by &lt;/span&gt;sysobjects&lt;span style="color: gray"&gt;.&lt;/span&gt;xtype &lt;span style="color: blue"&gt;desc&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;With schemas this pulls back incorrect users as the owner of objects.&amp;#160; Instead in SQL 2005, the query should look like this:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;select &lt;/span&gt;o&lt;span style="color: gray"&gt;.&lt;/span&gt;name&lt;span style="color: gray"&gt;, &lt;/span&gt;s&lt;span style="color: gray"&gt;.&lt;/span&gt;name [schema]&lt;span style="color: gray"&gt;, &lt;/span&gt;p&lt;span style="color: gray"&gt;.&lt;/span&gt;name [schema owner]&lt;span style="color: gray"&gt;, &lt;/span&gt;o&lt;span style="color: gray"&gt;.&lt;/span&gt;type_desc [Type]&lt;br /&gt;&lt;span style="color: blue"&gt;from &lt;/span&gt;&lt;span style="color: green"&gt;sys.objects &lt;/span&gt;o &lt;br /&gt;&lt;span style="color: gray"&gt;join &lt;/span&gt;&lt;span style="color: green"&gt;sys.schemas &lt;/span&gt;s &lt;span style="color: blue"&gt;on &lt;/span&gt;o&lt;span style="color: gray"&gt;.&lt;/span&gt;&lt;span style="color: magenta"&gt;schema_id &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;s&lt;span style="color: gray"&gt;.&lt;/span&gt;&lt;span style="color: magenta"&gt;schema_id&lt;br /&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;join &lt;/span&gt;&lt;span style="color: green"&gt;sys.database_principals &lt;/span&gt;p &lt;span style="color: blue"&gt;on &lt;/span&gt;s&lt;span style="color: gray"&gt;.&lt;/span&gt;principal_id &lt;span style="color: gray"&gt;= &lt;/span&gt;p&lt;span style="color: gray"&gt;.&lt;/span&gt;principal_id&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;In some cases like the above the output from the compatibility is not equivalent.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-5640945075465534231?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/5640945075465534231/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/07/difference-between-sql-2000-and-sql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/5640945075465534231'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/5640945075465534231'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/07/difference-between-sql-2000-and-sql.html' title='Difference between SQL 2000 and SQL 2005 system Views'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-3090604052614940448</id><published>2008-07-23T19:38:00.001-04:00</published><updated>2008-07-23T19:38:37.523-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Query Processing'/><category scheme='http://www.blogger.com/atom/ns#' term='SSMS'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA Tutorials'/><category scheme='http://www.blogger.com/atom/ns#' term='TSQL'/><title type='text'>How to Disable All Constraints or Triggers in a Single Command</title><content type='html'>&lt;p&gt;From time to time we all make mistakes, no DBA is immune from creating a total disaster with the click of a button.&amp;#160; Luckily today this was on a testing database and not on a production one, but a table hint out of place, resulted in the loss of a 90GB database table in less than a few seconds.&amp;#160; What started as a simple data purge ended up being nothing short of a disaster, albeit on a test database.&amp;#160; &lt;/p&gt;  &lt;p&gt;The idea was to purge roughly 80GB of the data from this table, so rather than issue a long running set based delete, I opened the table in the SSMS designer and made a change to one of the columns, then scripted the operation to a new window.&amp;#160; I did this so that I could replace the dynamic SQL Statement with a statement to grab the rows to keep.&amp;#160; The problem was I put the WITH (HOLDLOCK, TABLOCKX) after my WHERE clause.&amp;#160; Since this is dynamic SQL, the syntax will pass a syntax check, but when the code actually executes you get an exception, and no data is copied to the tmp_Tablename table from the original base table, and then the original base table is dropped, leaving you with a wonderfully empty new table.&lt;/p&gt;  &lt;p&gt;So on to fixing the problem and the purpose of this post.&amp;#160; To solve the problem, I used an integration package to pull the data from the production database table into a flat file which I then could import back into the testing server.&amp;#160; The problem came when I went to load the data, that check constraints failed, and the load failed.&amp;#160; What to do??&amp;#160; Well, it turns out that disabling all constraints and triggers in database is really simple, you just need to use the undocumented sp_msforeachtable stored procedure as follows:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: green"&gt;--Disable Constraints &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;EXEC &lt;/span&gt;&lt;span style="color: maroon"&gt;sp_MSforeachtable &lt;/span&gt;&lt;span style="color: red"&gt;'ALTER TABLE ? NOCHECK CONSTRAINT ALL' &lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: green"&gt;--Disable Triggers &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;EXEC &lt;/span&gt;&lt;span style="color: maroon"&gt;sp_MSforeachtable &lt;/span&gt;&lt;span style="color: red"&gt;'ALTER TABLE ? DISABLE TRIGGER ALL' &lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: green"&gt;-- Load data Now&lt;br /&gt;&lt;br /&gt;--Enable Constraints &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;EXEC &lt;/span&gt;&lt;span style="color: maroon"&gt;sp_MSforeachtable &lt;/span&gt;&lt;span style="color: red"&gt;'ALTER TABLE ? CHECK CONSTRAINT ALL' &lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: green"&gt;--Enable Triggers &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;EXEC &lt;/span&gt;&lt;span style="color: maroon"&gt;sp_MSforeachtable &lt;/span&gt;&lt;span style="color: red"&gt;'ALTER TABLE ? ENABLE TRIGGER ALL' &lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;this allowed for the data to be loaded, and then I was able to resolve the orphaned records as needed.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-3090604052614940448?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/3090604052614940448/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/07/how-to-disable-all-constraints-or.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/3090604052614940448'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/3090604052614940448'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/07/how-to-disable-all-constraints-or.html' title='How to Disable All Constraints or Triggers in a Single Command'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-8392201418763129672</id><published>2008-07-17T23:44:00.000-04:00</published><updated>2008-07-18T07:45:40.434-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DBA Tutorials'/><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>Free "Basic Training" for SQL Server</title><content type='html'>&lt;p&gt;There are often a number of questions that get asked on the forums that are really SQL Server 101 things.&amp;#160; My favorite posts are from people eager to get their start in SQL Server Development and or Administration.&amp;#160; Alot of links have been provided on these posts, and Buck Woody has posted a wonderful series of links for people wishing to strengthen their SQL Server Administration Skill Set on his blog.&amp;#160;&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/buckwoody/archive/2008/07/17/free-basic-training-for-sql-server.aspx"&gt;Carpe Datum : Free &amp;quot;Basic Training&amp;quot; for SQL Server&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Other Links of interest from working the forums are:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3537678&amp;amp;SiteID=1" href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3537678&amp;amp;SiteID=1"&gt;http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3537678&amp;amp;SiteID=1&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-8392201418763129672?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/8392201418763129672/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/07/free-training-for-sql-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/8392201418763129672'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/8392201418763129672'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/07/free-training-for-sql-server.html' title='Free &amp;quot;Basic Training&amp;quot; for SQL Server'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-1300009591975480613</id><published>2008-07-17T00:43:00.001-04:00</published><updated>2008-07-17T00:43:09.207-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2008'/><title type='text'>SQL SERVER - 2008 - Introduction to SPARSE Columns - Part 2 « Journey to SQL Authority with Pinal Dave</title><content type='html'>&lt;p&gt; SQL MVP Pinal Dave has a great new series on Sparse Columns in SQL 2008.&amp;#160; I would definitely recommend that you give it a look:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blog.sqlauthority.com/2008/07/14/sql-server-2008-introduction-to-sparse-columns-part-2/"&gt;SQL SERVER - 2008 - Introduction to SPARSE Columns - Part 2 &amp;#171; Journey to SQL Authority with Pinal Dave&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-1300009591975480613?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/1300009591975480613/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/07/sql-server-2008-introduction-to-sparse.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/1300009591975480613'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/1300009591975480613'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/07/sql-server-2008-introduction-to-sparse.html' title='SQL SERVER - 2008 - Introduction to SPARSE Columns - Part 2 « Journey to SQL Authority with Pinal Dave'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-7683006255499488709</id><published>2008-07-15T17:52:00.001-04:00</published><updated>2008-07-15T17:52:33.337-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>New Tool, though not for SQL Server</title><content type='html'>&lt;p&gt;Lately I have been getting information/feedback from visitors to SQLCLR.net that the site is not rendering properly in all browsers.&amp;#160; Looking at the Analytics for the site, most people are coming to the site with IE 7, probably something I should have paid attention to since the site wouldn't render in IE 7 correctly.&amp;#160; I have spent the better part of a week learning CSS, CSS Hacks, and all other forms of Web Development stuff to come to the conclusion that IE is the hardest browser to make render correctly if you have no clue.&lt;/p&gt;  &lt;p&gt;Along the way I happened on a neat tool called FireBug.&amp;#160; It is for Firefox and lets you play with the CSS locally from a live rendering of a site.&amp;#160; This is what ultimately let me figure out how to resolve all of the cross platform CSS formatting.&amp;#160; A new skin is now up and is actually better for SEO, since I was able to figure out proper content positioning in the site for non-Styled Rendering with Firefox.&amp;#160; The non-styled layout now allows the search engines to find the content for indexing first and moves all of the Links and Recent Items to the bottom of the page.&amp;#160; This should make for better indexing of the site data for better hits on searching.&amp;#160; Time will tell.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-7683006255499488709?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/7683006255499488709/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/07/new-tool-though-not-for-sql-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/7683006255499488709'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/7683006255499488709'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/07/new-tool-though-not-for-sql-server.html' title='New Tool, though not for SQL Server'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-2469807910772535986</id><published>2008-07-12T20:39:00.001-04:00</published><updated>2008-07-12T20:39:58.540-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='DBCC CHECKDB'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Error Messages'/><category scheme='http://www.blogger.com/atom/ns#' term='Upgrade'/><title type='text'>SqlDateTime Overflow after Upgrading to SQL 2005 From SQL 2000</title><content type='html'>&lt;p&gt;If you upgrade to SQL 2005 by Backup/Restore, it is possible that you will receive the following error when you issue a select statement against a table with a Datetime column in it:&lt;/p&gt;  &lt;p&gt;&lt;font color="#ff0000"&gt;An error occurred while executing batch. Error message is: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#000000"&gt;This error is not caught by a standard DBCC CHECKDB.&amp;#160; The books online for &lt;a href="http://msdn.microsoft.com/en-us/library/ms176064.aspx" target="_blank"&gt;DBCC CHECKDB&lt;/a&gt; says:&lt;/font&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;Under some circumstances, values might be entered into the database that are not valid or out-of-range based on the data type of the column. In SQL Server 2000, DBCC CHECKDB does not perform range or integrity checks on these column values. However, in SQL Server 2005, DBCC CHECKDB can detect column values that are not valid for all column data types. Therefore, running DBCC CHECKDB with the DATA_PURITY option on databases that have been upgraded from earlier versions of SQL Server might reveal preexisting column-value errors. Because SQL Server 2005 cannot automatically repair these errors, the column value must be manually updated. If CHECKDB detects such an error, CHECKDB returns a warning, the error number 2570, and information to identify the affected row and manually correct the error.&lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Once you follow these directions, your should no longer encounter this problem, since databases in SQL 2005 have data validation checks in place.&lt;/p&gt;  &lt;p&gt;For more information see:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://support.microsoft.com/kb/923247" target="_blank"&gt;Troubleshooting DBCC error 2570 in SQL Server 2005&lt;/a&gt;.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-2469807910772535986?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/2469807910772535986/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/07/sqldatetime-overflow-after-upgrading-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2469807910772535986'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/2469807910772535986'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/07/sqldatetime-overflow-after-upgrading-to.html' title='SqlDateTime Overflow after Upgrading to SQL 2005 From SQL 2000'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-275796906968798378</id><published>2008-07-11T10:41:00.000-04:00</published><updated>2008-07-29T14:42:06.267-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2008'/><title type='text'>SSMS Options in SQL 2008</title><content type='html'>&lt;p&gt;Glenn Allen Barry posted a neat new feature in the SQL 2008 SSMS options that made me wonder what else has changed, so I decided to do a feature check against the 2005 Management Studio Options.&amp;#160; First and foremost, I am happy to see that Microsoft decided to persist the SQL 2000 Keyboard configuration as an option.&amp;#160; I long ago learned the hot keys to comment code (Shft+Ctrl+C) and uncomment code (Shft+Ctrl+R) in the old query analyzer and old habits die hard, so I was extremely happy when I found this option in 2005.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/jmkehayias/SI9keYQFGLI/AAAAAAAAACM/HpMkj9UkIWM/image5.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="379" alt="image" src="http://lh5.ggpht.com/jmkehayias/SI9keTWEXQI/AAAAAAAAACQ/Fp8su9tMkms/image_thumb3.png" width="648" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The next change down the list is the addition of Transact-SQL in the Text Editor Options.&amp;#160; This is where you will control your Intellisense options, and how the editor for TSQL works.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/jmkehayias/SI9kelYps-I/AAAAAAAAACU/Mmw1aKr6p08/image9.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="379" alt="image" src="http://lh3.ggpht.com/jmkehayias/SI9kewbgaGI/AAAAAAAAACY/DLv9cJ2w37w/image_thumb5.png" width="648" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The Editor Tab and Status Bar Options affect what information is displayed in the tab for a specific connection, as well as what information is displayed in the status bar.&amp;#160; Perhaps you only want to show the FileName on the Tab, while you want to show the Server, LoginName, and DatabaseName in the Status bar.&amp;#160; This is now possible with this options set.&amp;#160; You can also move the Status bar from the bottom of the window to the top if you so choose.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/jmkehayias/SI9kfF68DNI/AAAAAAAAACc/NWXKVhOfZO4/image13.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="379" alt="image" src="http://lh5.ggpht.com/jmkehayias/SI9kfd7U1dI/AAAAAAAAACg/kQzfqtYzqCQ/image_thumb7.png" width="648" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-275796906968798378?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/275796906968798378/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/07/ssms-options-in-sql-2008.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/275796906968798378'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/275796906968798378'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/07/ssms-options-in-sql-2008.html' title='SSMS Options in SQL 2008'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/jmkehayias/SI9keTWEXQI/AAAAAAAAACQ/Fp8su9tMkms/s72-c/image_thumb3.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-3795517452117759283</id><published>2008-07-09T11:06:00.000-04:00</published><updated>2008-12-09T12:53:02.938-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSMS'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='Upgrade'/><title type='text'>Multi-Server Query Execution in SQL 2008</title><content type='html'>&lt;p&gt;As a DBA, have you ever needed to run a query against one of the system databases in all of your servers?  The tedious process of opening a Query in SSMS and then running it, changing the connection and running it again are over.  SQL 2008 now has the ability to run multi-server queries.  To utilize this new feature, requires at least one registered server group to run a script against multiple server. To setup a registered server group and servers, refer to &lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/ms181228%28SQL.100%29.aspx"&gt;http://msdn2.microsoft.com/en-us/library/ms181228(SQL.100).aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/ms183353%28SQL.100%29.aspx"&gt;http://msdn2.microsoft.com/en-us/library/ms183353(SQL.100).aspx&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Once you have your group created, you can right click on it and select the New Query Option:&lt;/p&gt;&lt;p&gt;&lt;a href="http://lh6.ggpht.com/jmkehayias/SHYlamBp-hI/AAAAAAAAABk/SRkffWoLpVc/image%5B3%5D.png"&gt;&lt;img style="border: 0px none ;" alt="image" src="http://lh5.ggpht.com/jmkehayias/SHYlanrQdSI/AAAAAAAAABo/kEvMPqZZcqM/image_thumb%5B1%5D.png" border="0" width="420" height="241" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;When you do this, some specific environmental changes will occur.  First, the Database Dropdown box will only have the common databases to all servers listed in it.  &lt;/p&gt;&lt;p&gt;&lt;a href="http://lh5.ggpht.com/jmkehayias/SHYla-nD_dI/AAAAAAAAABs/Y3e8jaCzG-k/image%5B7%5D.png"&gt;&lt;img style="border: 0px none ;" alt="image" src="http://lh6.ggpht.com/jmkehayias/SHYlbOXXjxI/AAAAAAAAABw/_EWFj2ewtJ8/image_thumb%5B3%5D.png" border="0" width="296" height="115" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;Second, the the status bar will turn from beige to Pink to show that this window is in multi-server mode.&lt;/p&gt;&lt;p&gt;&lt;a href="http://lh6.ggpht.com/jmkehayias/SHYlbIPHDUI/AAAAAAAAAB0/iVSA5l8ufqg/image%5B11%5D.png"&gt;&lt;img style="border: 0px none ;" alt="image" src="http://lh5.ggpht.com/jmkehayias/SHYlbJM6FcI/AAAAAAAAAB4/yE6zYEyNBdc/image_thumb%5B5%5D.png" border="0" width="476" height="49" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;Now we can run a simple database script.  For the purposes of demonstration I am going to use the script from the following SQL Examples article:&lt;/p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;blockquote&gt;&lt;p&gt;&lt;a href="http://code.msdn.microsoft.com/SQLExamples/Wiki/View.aspx?title=LastBackUpDate&amp;amp;referringTitle=Home"&gt;Find Last BackUp Date Of All Databases On Your Server&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;What you will notice when your run this command is that you now have an added column in the output, ServerName:&lt;/p&gt;&lt;p&gt;&lt;a href="http://lh3.ggpht.com/jmkehayias/SHYlbZoDfXI/AAAAAAAAAB8/QY5kJlGIRXc/image%5B15%5D.png"&gt;&lt;img style="border: 0px none ;" alt="image" src="http://lh5.ggpht.com/jmkehayias/SHYlbZhRs2I/AAAAAAAAACA/l-G0AW0YXHY/image_thumb%5B7%5D.png" border="0" width="468" height="54" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;You can configure the output of this columns in the SSMS Options under Query Results -&amp;gt; SQL Server -&amp;gt; Multiserver Results.  &lt;/p&gt;&lt;p&gt;&lt;a href="http://lh4.ggpht.com/jmkehayias/SHYlbmXjk5I/AAAAAAAAACE/qqmTsuBBShw/image%5B19%5D.png"&gt;&lt;img style="border: 0px none ;" alt="image" src="http://lh5.ggpht.com/jmkehayias/SHYlbj_gkUI/AAAAAAAAACI/ov0Mnz0xSyM/image_thumb%5B9%5D.png" border="0" width="648" height="379" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;What is really nice is that as long as your query can execute on all of the servers, this works with SQL 2000 and SQL 2005 Registered Servers as well.  Yet another tool available to ease the tasks as a DBA.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-3795517452117759283?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/3795517452117759283/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/07/multi-server-query-execution-in-sql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/3795517452117759283'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/3795517452117759283'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/07/multi-server-query-execution-in-sql.html' title='Multi-Server Query Execution in SQL 2008'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/jmkehayias/SHYlanrQdSI/AAAAAAAAABo/kEvMPqZZcqM/s72-c/image_thumb%5B1%5D.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-6164781867337818933</id><published>2008-07-07T21:33:00.001-04:00</published><updated>2008-07-07T21:33:44.837-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Query Processing'/><category scheme='http://www.blogger.com/atom/ns#' term='TSQL'/><title type='text'>Comparing 2 Results Sets to see if they are identical</title><content type='html'>&lt;p&gt;A &lt;a href="http://forums.microsoft.com/Forums/ShowPost.aspx?PostID=3584416&amp;amp;SiteID=1"&gt;post on the MSDN&lt;/a&gt; forums asked how to check if two results sets were identical, and Jim McLeod offered a pretty simple method to check this, that was worth sharing:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;SELECT CASE WHEN &lt;/span&gt;&lt;span style="color: magenta"&gt;COUNT&lt;/span&gt;&lt;span style="color: gray"&gt;(*) = &lt;/span&gt;0 &lt;span style="color: blue"&gt;THEN &lt;/span&gt;&lt;span style="color: red"&gt;'Same' &lt;/span&gt;&lt;span style="color: blue"&gt;ELSE &lt;/span&gt;&lt;span style="color: red"&gt;'Different' &lt;/span&gt;&lt;span style="color: blue"&gt;END&lt;br /&gt;FROM &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;br /&gt;        (&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: blue"&gt;SELECT &lt;/span&gt;&lt;span style="color: gray"&gt;* &lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;Table1 &lt;br /&gt;        &lt;span style="color: blue"&gt;EXCEPT&lt;br /&gt;        SELECT &lt;/span&gt;&lt;span style="color: gray"&gt;* &lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;Table2&lt;br /&gt;        &lt;span style="color: gray"&gt;) &lt;br /&gt;        &lt;/span&gt;&lt;span style="color: blue"&gt;UNION &lt;br /&gt;        &lt;/span&gt;&lt;span style="color: gray"&gt;(&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: blue"&gt;SELECT &lt;/span&gt;&lt;span style="color: gray"&gt;* &lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;Table2&lt;br /&gt;        &lt;span style="color: blue"&gt;EXCEPT&lt;br /&gt;        SELECT &lt;/span&gt;&lt;span style="color: gray"&gt;* &lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;Table1 &lt;br /&gt;        &lt;span style="color: gray"&gt;)&lt;br /&gt;) &lt;/span&gt;dv&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;This query basically gets all the rows that are in Table 1 but not Table 2, then UNIONS all rows that are in Table 2 but not Table 1.&amp;#160; If there's zero rows for both, the result sets must be the same.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Fast Simple, and easy to implement.&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-6164781867337818933?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/6164781867337818933/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/07/comparing-2-results-sets-to-see-if-they.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/6164781867337818933'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/6164781867337818933'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/07/comparing-2-results-sets-to-see-if-they.html' title='Comparing 2 Results Sets to see if they are identical'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1280552045292386283.post-5991210167234719388</id><published>2008-07-05T19:09:00.000-04:00</published><updated>2008-07-05T19:12:28.851-04:00</updated><title type='text'>TSQL versus CLR Performance:  Which is faster, why and when?</title><content type='html'>I am beginning to work on a series to determine which is faster TSQL or CLR, why, and when to use which.  I am going to be working in parallel with some other experts here to make sure that the TSQL and the CLR are both working optimally and doing similar operations to make sure that this testing is valid and covers all of the bases.  This is being sparked by the following post on the MSDN forums, and will be posted on &lt;a href="http://www.blogger.com/www.sqlclr.net"&gt;SQLCLR.net&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1280552045292386283-5991210167234719388?l=jmkehayias.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jmkehayias.blogspot.com/feeds/5991210167234719388/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jmkehayias.blogspot.com/2008/07/tsql-versus-clr-performance-which-is.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/5991210167234719388'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1280552045292386283/posts/default/5991210167234719388'/><link rel='alternate' type='text/html' href='http://jmkehayias.blogspot.com/2008/07/tsql-versus-clr-performance-which-is.html' title='TSQL versus CLR Performance:  Which is faster, why and when?'/><author><name>Jonathan Kehayias (MCITP, MVP)</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_CSUuS5p4wm0/SO0K2jSXhwI/AAAAAAAAADo/oxgEwPtJCjM/S220/MVPProfileImg.JPG'/></author><thr:total>1</thr:total></entry></feed>
