<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlblog.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Search results matching tags 'SQL Server 11', 'denali', and 'SQL Server 2011'</title><link>http://sqlblog.com/search/SearchResults.aspx?o=DateDescending&amp;tag=SQL+Server+11,denali,SQL+Server+2011&amp;orTags=0</link><description>Search results matching tags 'SQL Server 11', 'denali', and 'SQL Server 2011'</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>Connect Digest : 2011-05-02</title><link>http://sqlblog.com/blogs/aaron_bertrand/archive/2011/05/02/connect-digest-2011-05-02.aspx</link><pubDate>Mon, 02 May 2011 11:15:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:35217</guid><dc:creator>AaronBertrand</dc:creator><description>&lt;p&gt;This week, after seeing a lot of the DMV enhancements made in &lt;a href="http://sqlblog.com/blogs/aaron_bertrand/archive/2011/04/25/more-changes-you-might-not-have-noticed-in-the-sql-server-2008-r2-sp1-ctp.aspx" title="http://sqlblog.com/blogs/aaron_bertrand/archive/2011/04/25/more-changes-you-might-not-have-noticed-in-the-sql-server-2008-r2-sp1-ctp.aspx" target="_blank"&gt;SQL Server 2008 R2 SP1&lt;/a&gt;, I thought I would take a look at some dynamic management view/function requests.&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;b&gt;Page split personality&lt;/b&gt; &lt;br&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;Michael Zilberstein &lt;a href="http://sqlblog.com/blogs/michael_zilberstein/archive/2011/04/25/35175.aspx" title="http://sqlblog.com/blogs/michael_zilberstein/archive/2011/04/25/35175.aspx" target="_blank"&gt;blogged on Monday&lt;/a&gt; about how Extended Events and the transaction log differ in the way they report page split information, and that it would be useful to have accurate information about these events available in the DMVs. So he filed this Connect item:&lt;br&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;a href="http://connect.microsoft.com/SQLServer/feedback/details/664900/please-add-page-splits-data-per-index-index-level-and-page-split-type" title="http://connect.microsoft.com/SQLServer/feedback/details/664900/please-add-page-splits-data-per-index-index-level-and-page-split-type" target="_blank"&gt;#664900 : Please add page splits data per index, index level and page split type&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;I asked for a very similar item back in 2008, but thought that it belonged in sys.dm_db_index_physical_stats:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;a href="http://connect.microsoft.com/SQLServer/feedback/details/388403/include-page-split-information-in-sys-dm-db-index-physical-stats" title="http://connect.microsoft.com/SQLServer/feedback/details/388403/include-page-split-information-in-sys-dm-db-index-physical-stats" target="_blank"&gt;#388403 : Include page split information in sys.dm_db_index_physical_stats&lt;/a&gt;&amp;nbsp; &lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;They've already provided additional info via Extended Events (see &lt;a href="http://connect.microsoft.com/SQLServer/feedback/details/388482/sql-server-extended-events-page-split-event-additions" title="http://connect.microsoft.com/SQLServer/feedback/details/388482/sql-server-extended-events-page-split-event-additions" target="_blank"&gt;#388482 : SQL Server Extended Events Page/Split Event Additions&lt;/a&gt;) so, hopefully, they will take our DMV requests seriously as well.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;br&gt;&lt;b&gt;How stale is my database?&lt;/b&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;Kimberly Tripp (&lt;a href="http://www.sqlskills.com/blogs/kimberly/" title="http://www.sqlskills.com/blogs/kimberly/" target="_blank"&gt;blog&lt;/a&gt; | &lt;a href="http://twitter.com/KimberlyLTripp" title="http://twitter.com/KimberlyLTripp" target="_blank"&gt;twitter&lt;/a&gt;) posted this item, asking for a column in sys.databases to reflect last accessed time (I think it belongs in an existing or new DMV, not in the catalog view). An additional comment on the item suggested a terrific enhancement to this potential feature, where each individual login would be represented with their last access time, making it easy to differentiate when a database is only being accessed by system or background processes.&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;a href="http://connect.microsoft.com/SQLServer/feedback/details/659846/database-last-accessed-time" title="http://connect.microsoft.com/SQLServer/feedback/details/659846/database-last-accessed-time" target="_blank"&gt;#659846 : Database last accessed time&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;They've recently rejected a similar item requesting last accessed time for objects within a database (see &lt;a href="http://connect.microsoft.com/SQLServer/feedback/details/454714/i-should-be-able-to-see-the-last-time-an-object-was-accessed-in-sysobjects" title="http://connect.microsoft.com/SQLServer/feedback/details/454714/i-should-be-able-to-see-the-last-time-an-object-was-accessed-in-sysobjects" target="_blank"&gt;#454714 : I should be able to see the last time an object was accessed in sysobjects&lt;/a&gt;), though that one had zero votes, so I'm hopeful that Kimberly's request may be deemed both easier to implement and more important to the community. &lt;br&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;br&gt;&lt;b&gt;I'm an E7-8800, what are you?&lt;/b&gt;&lt;br&gt;&lt;/p&gt;&lt;blockquote&gt;Glenn Alan Berry (&lt;a href="http://sqlserverperformance.wordpress.com/" title="http://sqlserverperformance.wordpress.com/" target="_blank"&gt;blog&lt;/a&gt; | &lt;a href="http://twitter.com/GlennAlanBerry" title="http://twitter.com/GlennAlanBerry" target="_blank"&gt;twitter&lt;/a&gt;) asked for an additional column on the sys.dm_os_sys_info DMV that reflects the CPU's description (e.g. Xeon X5505). As you may have noticed on his blog, Glenn spends a lot of effort on analyzing performance of workloads on different CPUs, and there are some pretty substantial differences between CPUs that may look quite similar to the average person - especially when seeing vastly different performance on two servers that are otherwise very similar (same amount of RAM, same SAN, etc).&lt;br&gt;&lt;blockquote&gt;&lt;p&gt;&lt;a href="http://connect.microsoft.com/SQLServer/feedback/details/657435/add-a-processor-description-column-to-sys-dm-os-sys-info-in-sql-server-denali" title="http://connect.microsoft.com/SQLServer/feedback/details/657435/add-a-processor-description-column-to-sys-dm-os-sys-info-in-sql-server-denali" target="_blank"&gt;#657435 : Add a processor_description column to sys.dm_os_sys_info in SQL Server Denali&lt;/a&gt;&lt;br&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;An additional comment requested that the true observed speed would be shown, as opposed (or in addition) to the manufacturer's stated clock speed - the true speed is a number than can vary greatly if you are using power saving options.&lt;br&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;br&gt;&lt;b&gt;You're a word, but are you reserved?&lt;/b&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;This almost certainly wouldn't be in a DMV, but I still like the idea and it almost fits here. Greg Low (&lt;a href="http://sqlblog.com/blogs/greg_low/default.aspx" title="http://sqlblog.com/blogs/greg_low/default.aspx" target="_blank"&gt;blog&lt;/a&gt; | &lt;a href="http://twitter.com/greglow" title="http://twitter.com/greglow" target="_blank"&gt;twitter&lt;/a&gt;) is requesting a system view of some kind that exposes a list of reserved words - my comment here was that relying on IntelliSense alone is a fool's errand.&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;a href="http://connect.microsoft.com/SQLServer/feedback/details/653455/system-view-that-lists-reserved-words" title="http://connect.microsoft.com/SQLServer/feedback/details/653455/system-view-that-lists-reserved-words" target="_blank"&gt;#653455 : System View that lists Reserved Words&lt;/a&gt;&amp;nbsp; &lt;br&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;On a somewhat-but-not-really-related note, Meredith Ryan-Smith (&lt;a href="http://meredithryansmith.wordpress.com/" title="http://meredithryansmith.wordpress.com/" target="_blank"&gt;blog&lt;/a&gt; | &lt;a href="http://twitter.com/coffegrl" title="http://twitter.com/coffegrl" target="_blank"&gt;twitter&lt;/a&gt;) recently &lt;a href="http://meredithryansmith.wordpress.com/2011/04/25/of-course-thats-how-you-spell-sp_msacquireheadofqueuelock/" title="http://meredithryansmith.wordpress.com/2011/04/25/of-course-thats-how-you-spell-sp_msacquireheadofqueuelock/" target="_blank"&gt;blogged about a workaround&lt;/a&gt; she used to export all of the object names from sys.all_objects into a custom dictionary for use in Word, PowerPoint, etc. to avoid the ugly red squiggly lines pointing out that you misspelled sp_server_diagnostics and sp_who2. I think that if the metadata Greg is asking for were made available, then this idea would be easy to extend to reserved words, so that Word also wouldn't try to convince you that perfectly valid "words" like COLUMNSTORE and DATA_COMPRESSION are spelled wrong.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;br&gt;&lt;b&gt;Do you really like DBCC?&lt;/b&gt;&lt;br&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;Greg Low also requested that the information returned by running DBCC SHOW_STATISTICS be made available through a DMV (another user suggested &lt;a href="http://connect.microsoft.com/SQLServer/feedback/details/475270/add-column-to-sys-stats-to-indicate-if-the-optimizer-considers-statistics-out-of-date-invalid" title="http://connect.microsoft.com/SQLServer/feedback/details/475270/add-column-to-sys-stats-to-indicate-if-the-optimizer-considers-statistics-out-of-date-invalid" target="_blank"&gt;adding a column like is_stale to sys.stats&lt;/a&gt;, but I think a separate DMV makes more sense).&lt;br&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt; &lt;a href="http://connect.microsoft.com/SQLServer/feedback/details/611155/dbcc-show-statistics-info-should-be-available-as-a-dmv" title="http://connect.microsoft.com/SQLServer/feedback/details/611155/dbcc-show-statistics-info-should-be-available-as-a-dmv" target="_blank"&gt;#611155 : DBCC SHOW_STATISTICS info should be available as a DMV&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Exposing this information in a DMV would also, presumably, make it easier to access information like STATS_DATE without having to be in the context of that database (see &lt;a href="http://connect.microsoft.com/SQLServer/feedback/details/654972/stats-date-only-works-as-documented-when-current-db-is-where-the-tables-are" title="http://connect.microsoft.com/SQLServer/feedback/details/654972/stats-date-only-works-as-documented-when-current-db-is-where-the-tables-are" target="_blank"&gt;#654972 : STATS_DATE only works as documented when current db is where the tables are&lt;/a&gt;).&lt;/p&gt;&lt;p&gt;&amp;nbsp; &lt;br&gt;&lt;/p&gt;&lt;/blockquote&gt;</description></item><item><title>SQL Bits 8: &amp;quot;What's New in SQL Server Denali?&amp;quot;</title><link>http://sqlblog.com/blogs/aaron_bertrand/archive/2011/04/09/sql-bits-8-what-s-new-in-sql-server-denali.aspx</link><pubDate>Sat, 09 Apr 2011 23:25:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:34394</guid><dc:creator>AaronBertrand</dc:creator><description>&lt;p&gt;At SQL Bits I presented my "What's New in Denali?" deck in two different sessions - once on Friday to about 120 people, and once on Saturday to about 80 people. You can download the deck and samples below.&lt;/p&gt;&lt;p&gt;&amp;nbsp; &lt;br&gt;&lt;/p&gt;</description></item><item><title>SQL Saturday #67, Chicago: &amp;quot;What's New in SQL Server Denali&amp;quot;</title><link>http://sqlblog.com/blogs/aaron_bertrand/archive/2011/03/26/sql-saturday-67-chicago-what-s-new-in-sql-server-denali.aspx</link><pubDate>Sat, 26 Mar 2011 15:01:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:34390</guid><dc:creator>AaronBertrand</dc:creator><description>&lt;p&gt;Today I was in Chicago for &lt;a href="http://www.sqlsaturday.com/67/eventhome.aspx" title="http://www.sqlsaturday.com/67/eventhome.aspx" target="_blank"&gt;SQL Saturday #67&lt;/a&gt; to present my "What's New in SQL Server Denali" deck. You can download the deck and samples below.&lt;/p&gt;&lt;p&gt;I mentioned during the talk that THROW is another command added to the list that require the previous statement to be terminated with a semi-colon. Here is the blog post I referenced that talked more about &lt;a href="http://sqlblog.com/blogs/aaron_bertrand/archive/2009/09/03/ladies-and-gentlemen-start-your-semi-colons.aspx" title="http://sqlblog.com/blogs/aaron_bertrand/archive/2009/09/03/ladies-and-gentlemen-start-your-semi-colons.aspx" target="_blank"&gt;why you should start using semi-colons today&lt;/a&gt;. &lt;/p&gt;&lt;p&gt;I liked the feedback mechanism at this event. Everyone was handed an evaluation, and the drawings took place after each session at the chapter table downstairs. Much more compelling to get your evals in right away, and even better, I get them back right after that. Which means I can tally my scores and see what went well, and more importantly, what didn't go well (and wasn't obvious). The evals were much simpler than some other events. Two basic questions and room for comments (not everyone left comments, and not everyone answered both questions):&lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Expectation (circle one): Did Not Meet / Met / Exceeded&lt;/b&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;Met: 23 / 34&lt;br&gt;Exceeded: 11 / 34&lt;br&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;b&gt;Overall quality (5 = great):&lt;/b&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;3: 4 / 32&lt;br&gt;4: 11 / 32&lt;br&gt;5: 17 / 32&lt;br&gt;Average: &lt;font color="#006600"&gt;&lt;b&gt;4.41&lt;/b&gt;&lt;/font&gt; &amp;nbsp; &lt;br&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Not top scores, no, but I still feel pretty good about this. What I liked most? Seven comments included one of my brand words, "knowledgeable." Well, a couple used the variation "knowledge" - but that counts, right? &lt;br&gt;&lt;/p&gt;&lt;p&gt;The comment that surprised me most was a complaint that I didn't cover any BI. Even though I stated multiple times at the beginning that I wouldn't be covering BI - and even dedicated my very first "real" slide to this fact. Still, I've taken the feedback. For future events I'm going to change the title of the session to "SQL Server Denali : What's New in Engine, Setup and Tools." &lt;/p&gt;&lt;p&gt;I also gave a quick demo of SQL Sentry Plan Explorer in our vendor session at lunch (we were a "You Rock!" sponsor of SQL Saturday #67, after all). I didn't use a deck and it was all demos. Plan Explorer is free; if you haven't already tried it, please go to &lt;a href="http://sqlsentry.net/plan-explorer/sql-server-query-view.asp" title="http://sqlsentry.net/plan-explorer/sql-server-query-view.asp" target="_blank"&gt;the download page&lt;/a&gt; and read my &lt;a href="http://sqlblog.com/search/SearchResults.aspx?q=%22plan+explorer%22&amp;amp;s=18" title="http://sqlblog.com/search/SearchResults.aspx?q=%22plan+explorer%22&amp;amp;s=18" target="_blank"&gt;previous blog posts&lt;/a&gt; about the tool.&lt;br&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &lt;br&gt;&lt;/p&gt;</description></item><item><title>Presenting &amp;quot;What's New in SQL Server Denali&amp;quot; for WVPASS</title><link>http://sqlblog.com/blogs/aaron_bertrand/archive/2011/03/17/presenting-what-s-new-in-sql-server-denali-for-wvpass.aspx</link><pubDate>Thu, 17 Mar 2011 21:00:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:34231</guid><dc:creator>AaronBertrand</dc:creator><description>&lt;p&gt;Recently I was asked by John Sterrett (&lt;a href="http://johnsterrett.com/" title="http://johnsterrett.com/" target="_blank"&gt;blog&lt;/a&gt; | &lt;a href="http://twitter.com/johnsterrett" title="http://twitter.com/johnsterrett" target="_blank"&gt;twitter&lt;/a&gt;) to present to his SQL Server user group (&lt;a href="http://wvpass.sqlpass.org/" title="http://wvpass.sqlpass.org/" target="_blank"&gt;WVPASS&lt;/a&gt;) in Wheeling, West Virginia. Well, today is the day, and I will be presenting, "What's new in SQL Server Denali" at tonight's meeting, sponsored by &lt;a href="http://sqlsentry.net" title="http://sqlsentry.net" target="_blank"&gt;SQL Sentry&lt;/a&gt;. The slide deck is attached below; the samples are available &lt;a href="http://sqlblog.com/files/folders/34238/download.aspx" title="http://sqlblog.com/files/folders/34238/download.aspx" target="_blank"&gt;here&lt;/a&gt;. &lt;/p&gt;&lt;p&gt;If you attended this presentation, please feel free to &lt;a href="http://speakerrate.com/talks/6880-what-s-new-in-sql-server-denali" title="http://speakerrate.com/talks/6880-what-s-new-in-sql-server-denali" target="_blank"&gt;provide feedback at SpeakerRate&lt;/a&gt;. &lt;br&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;br&gt;&lt;/p&gt;</description></item><item><title>SQL Server v.Next (&amp;quot;Denali&amp;quot;) : How a columnstore index is not like a normal index</title><link>http://sqlblog.com/blogs/aaron_bertrand/archive/2011/02/28/sql-server-v-next-denali-how-a-columnstore-index-is-not-like-a-normal-index.aspx</link><pubDate>Mon, 28 Feb 2011 17:34:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:33810</guid><dc:creator>AaronBertrand</dc:creator><description>&lt;p&gt;At the end of my Denali presentation at &lt;a href="http://sqlsaturday.com/65/eventhome.aspx" title="http://sqlsaturday.com/65/eventhome.aspx" target="_blank"&gt;SQL Saturday #65&lt;/a&gt; in Vancouver, a member of the audience asked, "What makes a columnstore index different from a regular nonclustered index?" At the end of a busy day, I was at a loss for an answer, and I'll explain why.&lt;/p&gt;&lt;p&gt;First, I'll briefly explain the basic, core, high-level functionality of a columnstore index (you can read a lot more details in &lt;a href="http://bit.ly/AB_Denali_ColumnWP" title="http://bit.ly/AB_Denali_ColumnWP" target="_blank"&gt;this white paper&lt;/a&gt;). Basically, instead of storing index data together on a page, it divvies up the data from each column into its own set of pages. If you are after the data from only one column, this doesn't provide a great advantage over a traditional index, since you're not going to be able to store that many more rows on a page.&lt;br&gt;&lt;/p&gt;&lt;p&gt;The reason I was having a hard time articulating the benefit is because I was thinking about a simple non-clustered index with one column, and comparing it to a columnstore index with only one column defined. The benefit of the columnstore index is that you can basically declare it against most or all of the columns in a table, effectively similar to creating an index on each column - and this is where column store indexes provide the largest benefit. The differences between a column store index and a handful of indexes for each column are (1) size due to the structure of the index and the fact that compression will likely work much better when you can fit more like values on a page, and (2) you only pay for the index maintenance on a columnstore index once, because of what I'll describe next.&lt;br&gt;&lt;/p&gt;&lt;p&gt;The columnstore index has limitations that definitely make you feel like the grass is greener on the other side. Most importantly, in Denali, due to the cost of maintenance, a columnstore index will be read only... essentially, you will need to rebuild the index when data changes. Some other limitations: only one columnstore index per table, the index must be partition-aligned, can't be filtered, and the base object must be a table (so, no indexed views).&lt;br&gt;&lt;/p&gt;&lt;p&gt;This feature is definitely geared to data warehouse scenarios, or where you are free to rebuild indexes nightly or on some other interval. I can't give you a good idea about the cost of maintaining this index manually compared to multiple traditional indexes, since the feature did not make the cut for the &lt;a href="http://bit.ly/AB_Denali_Download" title="http://bit.ly/AB_Denali_Download" target="_blank"&gt;publicly available CTP1&lt;/a&gt;. But I hope to publish some blog posts with real numbers on both the read and write sides when the next public CTP is made available. I am fairly certain I will be able to demonstrate cases where this type of index will drastically increase read performance (without losing substantial write performance), provided that you are in a scenario where you can update the data on an infrequent schedule, such as nightly.&lt;/p&gt;&lt;p&gt;If you want some detailed background on this technology, please check out Dr. David DeWitt's &lt;a href="http://bit.ly/eYzuYD" title="http://bit.ly/eYzuYD" target="_blank"&gt;PASS Summit 2009 keynote slide deck&lt;/a&gt;. And if you’re a PASS member, you can access the video at &lt;a href="http://www.sqlpass.org/LearningCenter/SessionRecordings/Summit2009/Day3KeynoteDavidDeWitt.aspx" title="http://www.sqlpass.org/LearningCenter/SessionRecordings/Summit2009/Day3KeynoteDavidDeWitt.aspx" target="_blank"&gt;sqlpass.org&lt;/a&gt; (login required). &lt;br&gt;&lt;/p&gt;&lt;p&gt;[I am currently at the MVP Summit, and I just want to clarify (in case anyone was wondering), none of the material I discuss above is in violation of NDA.] &lt;br&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Slides and samples from SQL Saturday #65 - Vancouver</title><link>http://sqlblog.com/blogs/aaron_bertrand/archive/2011/02/26/slides-and-samples-from-sql-saturday-65-vancouver.aspx</link><pubDate>Sun, 27 Feb 2011 00:53:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:33795</guid><dc:creator>AaronBertrand</dc:creator><description>&lt;p&gt;Today I presented my "What's New in SQL Server 'Denali'" deck to about 40 attendees at &lt;a href="http://sqlsaturday.com/65/eventhome.aspx" title="http://sqlsaturday.com/65/eventhome.aspx" target="_blank"&gt;SQL Saturday #65&lt;/a&gt; in Vancouver, British Columbia. Attached below (and &lt;a href="http://sqlblog.com/blogs/aaron_bertrand/attachment/33795.ashx" title="http://sqlblog.com/blogs/aaron_bertrand/attachment/33795.ashx"&gt;here&lt;/a&gt;) are the slightly updated slides and samples.&lt;/p&gt;</description></item><item><title>Slide decks and samples from SQL Saturday #60 - Cleveland</title><link>http://sqlblog.com/blogs/aaron_bertrand/archive/2011/02/05/slide-decks-and-samples-from-sql-saturday-60-cleveland.aspx</link><pubDate>Sat, 05 Feb 2011 22:34:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:33178</guid><dc:creator>AaronBertrand</dc:creator><description>&lt;p&gt;Attached are the slide decks and demos from my two presentations at &lt;a href="http://www.sqlsaturday.com/60/eventhome.aspx" title="http://www.sqlsaturday.com/60/eventhome.aspx" target="_blank"&gt;SQL Saturday #60&lt;/a&gt; in Cleveland:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://sqlblog.com/files/folders/33222/download.aspx" title="Denali.zip" target="_blank"&gt;What's New in SQL Server "Denali"&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://sqlblog.com/files/folders/33223/download.aspx" title="BadHabitsToKick.zip" target="_blank"&gt;T-SQL : Bad Habits to Kick&lt;/a&gt;&lt;br&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>SQL Server v.Next (Denali) : Changes to performance counters</title><link>http://sqlblog.com/blogs/aaron_bertrand/archive/2011/01/08/sql-server-v-next-denali-changes-to-performance-counters.aspx</link><pubDate>Sat, 08 Jan 2011 17:44:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:32435</guid><dc:creator>AaronBertrand</dc:creator><description>&lt;p&gt;In a previous post about &lt;a href="http://sqlblog.com/blogs/aaron_bertrand/archive/2010/11/29/sql-server-v-next-denali-new-changed-and-removed-system-objects.aspx" title="http://sqlblog.com/blogs/aaron_bertrand/archive/2010/11/29/sql-server-v-next-denali-new-changed-and-removed-system-objects.aspx" target="_blank"&gt;changed system objects in Denali&lt;/a&gt;, I talked about the changes to memory-related DMVs due to underlying changes in the memory manager.&amp;nbsp; The SQLOS team has posted a &lt;a href="http://sqlblog.com/blogs/sqlos_team/archive/2011/01/04/sql-server-memory-manager-changes-in-denali.aspx" title="http://sqlblog.com/blogs/sqlos_team/archive/2011/01/04/sql-server-memory-manager-changes-in-denali.aspx" target="_blank"&gt;great introduction to these changes&lt;/a&gt;, and they plan to post more details in future posts.&amp;nbsp; In the meantime, and due to a question yesterday from Tom LaRock (&lt;a href="http://thomaslarock.com" title="http://thomaslarock.com" target="_blank"&gt;blog&lt;/a&gt; | &lt;a href="http://twitter.com/SQLRockstar" title="http://twitter.com/SQLRockstar" target="_blank"&gt;twitter&lt;/a&gt;) ...&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&amp;nbsp;&lt;img src="http://sqlblog.com/files/folders/32434/download.aspx" width="406" height="124"&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt; ... I thought I would tell you about some performance counters that have changed between SQL Server 2008 R2 and Denali - most of which involve these memory manager changes.&amp;nbsp; In response to Tom, initially I just performed a count and compared, but this isn't very accurate; since many counters are database-specific, the counts depend greatly on how many databases you have installed (as well as edition and features - more on that below).&amp;nbsp; So instead I wanted to query and see the actual differences ... on a 2008 R2 instance, I created a linked server pointing to a Denali instance, then I ran this query:&lt;/p&gt;

&lt;blockquote&gt;
&lt;table bgcolor="#eeeeee" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;pre style="padding:10px 20px;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;"&gt;&lt;font&gt;&lt;font color="gray"&gt;;&lt;/font&gt;&lt;/font&gt;&lt;font color="blue"&gt;WITH &lt;/font&gt;&lt;font color="black"&gt;loc &lt;/font&gt;&lt;font color="blue"&gt;AS&lt;br&gt;&lt;/font&gt;&lt;font color="gray"&gt;(&lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="blue"&gt;SELECT &lt;/font&gt;&lt;font color="black"&gt;obj&lt;/font&gt;&lt;font color="gray"&gt;, &lt;/font&gt;&lt;font color="black"&gt;cn&lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="blue"&gt;FROM &lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="gray"&gt;(&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="blue"&gt;SELECT&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;obj&lt;/font&gt;&lt;font&gt;&lt;font color="gray"&gt; =&lt;/font&gt;&lt;/font&gt;&lt;font color="blue"&gt; &lt;/font&gt;&lt;font color="magenta"&gt;SUBSTRING&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;[object_name]&lt;/font&gt;&lt;font color="gray"&gt;, &lt;/font&gt;&lt;font&gt;&lt;font color="magenta"&gt;CHARINDEX&lt;/font&gt;&lt;/font&gt;&lt;font color="blue"&gt;&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="red"&gt;':'&lt;/font&gt;&lt;font color="gray"&gt;, &lt;/font&gt;&lt;font color="black"&gt;[object_name]&lt;/font&gt;&lt;font color="gray"&gt;) + &lt;/font&gt;&lt;font color="black"&gt;1&lt;/font&gt;&lt;font color="gray"&gt;, &lt;/font&gt;&lt;font color="black"&gt;256&lt;/font&gt;&lt;font color="gray"&gt;), &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;cn&lt;/font&gt;&lt;font&gt;&lt;font color="gray"&gt; =&lt;/font&gt;&lt;/font&gt;&lt;font color="blue"&gt; &lt;/font&gt;&lt;font color="black"&gt;counter_name&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="blue"&gt;FROM &lt;/font&gt;&lt;font color="black"&gt;&lt;font color="green"&gt;sys&lt;/font&gt;.&lt;font color="green"&gt;dm_os_performance_counters&lt;/font&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="gray"&gt;) &lt;/font&gt;&lt;font color="blue"&gt;AS &lt;/font&gt;&lt;font color="black"&gt;x&lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="blue"&gt;GROUP BY &lt;/font&gt;&lt;font color="black"&gt;obj&lt;/font&gt;&lt;font color="gray"&gt;, &lt;/font&gt;&lt;font color="black"&gt;cn&lt;br&gt;&lt;/font&gt;&lt;font color="gray"&gt;),&lt;br&gt;&lt;/font&gt;&lt;font color="black"&gt;rem &lt;/font&gt;&lt;font color="blue"&gt;AS &lt;br&gt;&lt;/font&gt;&lt;font color="gray"&gt;(&lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="blue"&gt;SELECT &lt;/font&gt;&lt;font color="black"&gt;obj&lt;/font&gt;&lt;font color="gray"&gt;, &lt;/font&gt;&lt;font color="black"&gt;cn&lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="blue"&gt;FROM &lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="gray"&gt;(&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="blue"&gt;SELECT&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;obj&lt;/font&gt;&lt;font&gt;&lt;font color="gray"&gt; =&lt;/font&gt;&lt;/font&gt;&lt;font color="blue"&gt; &lt;/font&gt;&lt;font color="magenta"&gt;SUBSTRING&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;[object_name]&lt;/font&gt;&lt;font color="gray"&gt;, &lt;/font&gt;&lt;font&gt;&lt;font color="magenta"&gt;CHARINDEX&lt;/font&gt;&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="red"&gt;':'&lt;/font&gt;&lt;font color="gray"&gt;, &lt;/font&gt;&lt;font color="black"&gt;[object_name]&lt;/font&gt;&lt;font color="gray"&gt;) + &lt;/font&gt;&lt;font color="black"&gt;1&lt;/font&gt;&lt;font color="gray"&gt;, &lt;/font&gt;&lt;font color="black"&gt;256&lt;/font&gt;&lt;font color="gray"&gt;), &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;cn&lt;/font&gt;&lt;font&gt;&lt;font color="gray"&gt; =&lt;/font&gt;&lt;/font&gt;&lt;font color="blue"&gt; &lt;/font&gt;&lt;font color="black"&gt;counter_name&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="blue"&gt;FROM &lt;/font&gt;&lt;font color="black"&gt;[Denali_Linked_Server].[master].&lt;/font&gt;&lt;font color="black"&gt;&lt;font color="green"&gt;sys&lt;/font&gt;.&lt;font color="green"&gt;dm_os_performance_counters&lt;/font&gt;&lt;/font&gt;&lt;font color="black"&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="gray"&gt;) &lt;/font&gt;&lt;font color="blue"&gt;AS &lt;/font&gt;&lt;font color="black"&gt;x&lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="blue"&gt;GROUP BY &lt;/font&gt;&lt;font color="black"&gt;obj&lt;/font&gt;&lt;font color="gray"&gt;, &lt;/font&gt;&lt;font color="black"&gt;cn&lt;br&gt;&lt;/font&gt;&lt;font color="gray"&gt;)&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;SELECT &lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;[2008R2_obj]&lt;/font&gt;&lt;font&gt;&lt;font color="gray"&gt; =&lt;/font&gt;&lt;/font&gt;&lt;font color="blue"&gt; &lt;/font&gt;&lt;font color="black"&gt;loc.obj&lt;/font&gt;&lt;font color="gray"&gt;, &lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;[2008R2_ctr]&lt;/font&gt;&lt;font&gt;&lt;font color="gray"&gt; =&lt;/font&gt;&lt;/font&gt;&lt;font color="blue"&gt; &lt;/font&gt;&lt;font color="black"&gt;loc.cn&lt;/font&gt;&lt;font color="gray"&gt;,&lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;[Denali_obj]&lt;/font&gt;&lt;font&gt;&lt;font color="gray"&gt; =&lt;/font&gt;&lt;/font&gt;&lt;font color="blue"&gt; &lt;/font&gt;&lt;font color="black"&gt;rem.obj&lt;/font&gt;&lt;font color="gray"&gt;,&lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;[Denali_ctr]&lt;/font&gt;&lt;font&gt;&lt;font color="gray"&gt; =&lt;/font&gt;&lt;/font&gt;&lt;font color="blue"&gt; &lt;/font&gt;&lt;font color="black"&gt;rem.cn&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;FROM&lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;loc &lt;br&gt;&lt;/font&gt;&lt;font color="gray"&gt;FULL OUTER &lt;/font&gt;&lt;font color="blue"&gt;JOIN&lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;rem &lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="blue"&gt;ON &lt;/font&gt;&lt;font color="black"&gt;loc.obj&lt;/font&gt;&lt;font&gt;&lt;font color="gray"&gt; =&lt;/font&gt;&lt;/font&gt;&lt;font color="blue"&gt; &lt;/font&gt;&lt;font color="blue"&gt;&lt;/font&gt;&lt;font color="black"&gt;rem.obj&lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="gray"&gt;AND &lt;/font&gt;&lt;font color="black"&gt;loc.cn&lt;/font&gt;&lt;font&gt;&lt;font color="gray"&gt; =&lt;/font&gt;&lt;/font&gt;&lt;font color="blue"&gt; &lt;/font&gt;&lt;font color="blue"&gt;&lt;/font&gt;&lt;font color="black"&gt;rem.cn&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;WHERE &lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;loc.obj    &lt;/font&gt;&lt;font color="blue"&gt;IS &lt;/font&gt;&lt;font color="gray"&gt;NULL&lt;br&gt;&amp;nbsp;&amp;nbsp; OR &lt;/font&gt;&lt;font color="black"&gt;rem.obj &lt;/font&gt;&lt;font color="blue"&gt;IS &lt;/font&gt;&lt;font color="gray"&gt;NULL&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;ORDER BY&lt;br&gt;&lt;/font&gt;&lt;font color="gray"&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;[Denali_obj]&lt;/font&gt;&lt;font color="gray"&gt;,&lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;[Denali_ctr]&lt;/font&gt;&lt;font&gt;&lt;font color="gray"&gt;,&lt;br&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="blue"&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;[2008R2_obj]&lt;/font&gt;&lt;font color="gray"&gt;, &lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;[2008R2_ctr]&lt;/font&gt;&lt;font color="black"&gt;&lt;/font&gt;&lt;font color="gray"&gt;;&lt;/font&gt;&lt;/pre&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/blockquote&gt;


&lt;p&gt;The results:&lt;br&gt;&lt;/p&gt;


&lt;blockquote&gt;
&lt;table style="border-collapse:collapse;" cellpadding="5" cellspacing="0"&gt;


&lt;tr&gt;
&lt;th style="border:1px solid black;"&gt;2008 R2 Object&lt;/th&gt;
&lt;th style="border:1px solid black;"&gt;2008 R2 Counter&lt;/th&gt;
&lt;th style="border:1px solid black;"&gt;Denali Object&lt;/th&gt;
&lt;th style="border:1px solid black;"&gt;Denali Counter&lt;/th&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;"&gt;Buffer Manager&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;AWE lookup maps/sec&lt;/td&gt;
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;removed in Denali&amp;gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;"&gt;Buffer Manager&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;AWE stolen maps/sec&lt;/td&gt;
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;removed in Denali&amp;gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;"&gt;Buffer Manager&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;AWE unmap calls/sec&lt;/td&gt;
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;removed in Denali&amp;gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;"&gt;Buffer Manager&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;AWE unmap pages/sec&lt;/td&gt;
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;removed in Denali&amp;gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;"&gt;Buffer Manager&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;AWE write maps/sec&lt;/td&gt;
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;removed in Denali&amp;gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;"&gt;Buffer Manager&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Free pages&lt;/td&gt;
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;removed in Denali&amp;gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;"&gt;Buffer Manager&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Reserved pages&lt;/td&gt;
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;removed in Denali&amp;gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;"&gt;Buffer Manager&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Stolen pages&lt;/td&gt;
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;removed in Denali&amp;gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;"&gt;Buffer Manager&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Target pages&lt;/td&gt;
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;removed in Denali&amp;gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;"&gt;Buffer Manager&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Total pages&lt;/td&gt;
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;removed in Denali&amp;gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;"&gt;Buffer Node&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Foreign pages&lt;/td&gt;
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;removed in Denali&amp;gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;"&gt;Buffer Node&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Free pages&lt;/td&gt;
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;removed in Denali&amp;gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;"&gt;Buffer Node&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Stolen pages&lt;/td&gt;
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;removed in Denali&amp;gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;"&gt;Buffer Node&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Target pages&lt;/td&gt;
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;removed in Denali&amp;gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;"&gt;Buffer Node&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Total pages&lt;/td&gt;
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;removed in Denali&amp;gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;"&gt;Buffer Partition&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Free list empty/sec&lt;/td&gt;
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;removed in Denali&amp;gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;"&gt;Buffer Partition&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Free list requests/sec&lt;/td&gt;
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;removed in Denali&amp;gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;"&gt;Buffer Partition&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Free pages&lt;/td&gt;
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;removed in Denali&amp;gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;new in Denali&amp;gt;&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Access Methods&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;InSysXact waits/sec&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;new in Denali&amp;gt;&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Availability Replica&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Bytes Received from Replica/sec&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;new in Denali&amp;gt;&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Availability Replica&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Bytes Sent to Replica/sec&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;new in Denali&amp;gt;&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Availability Replica&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Bytes Sent to Transport/sec&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;new in Denali&amp;gt;&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Availability Replica&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Flow Control Time (ms/sec)&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;new in Denali&amp;gt;&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Availability Replica&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Flow Control/sec&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;new in Denali&amp;gt;&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Availability Replica&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Receives from Replica/sec&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;new in Denali&amp;gt;&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Availability Replica&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Resent Messages/sec&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;new in Denali&amp;gt;&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Availability Replica&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Sends to Replica/sec&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;new in Denali&amp;gt;&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Availability Replica&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Sends to Transport/sec&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;new in Denali&amp;gt;&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Database Replica&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;File Bytes Received/sec&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;new in Denali&amp;gt;&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Database Replica&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Log Bytes Received/sec&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;new in Denali&amp;gt;&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Database Replica&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Log Send Queue&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;new in Denali&amp;gt;&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Database Replica&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Recovery Queue&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;new in Denali&amp;gt;&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Database Replica&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Redone Bytes/sec&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;new in Denali&amp;gt;&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Databases&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Log Flush Write Time (ms)&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;new in Denali&amp;gt;&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Memory Manager&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Database Cache Memory (KB)&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;new in Denali&amp;gt;&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Memory Manager&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Free Memory (KB)&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;new in Denali&amp;gt;&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Memory Manager&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Log Pool Memory (KB)&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;new in Denali&amp;gt;&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Memory Manager&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Reserved Server Memory (KB)&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;new in Denali&amp;gt;&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Memory Manager&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Stolen Server Memory (KB)&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;new in Denali&amp;gt;&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Memory Node&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Database Node Memory (KB)&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;new in Denali&amp;gt;&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Memory Node&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Foreign Node Memory (KB)&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;new in Denali&amp;gt;&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Memory Node&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Free Node Memory (KB)&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;new in Denali&amp;gt;&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Memory Node&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Stolen Node Memory (KB)&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;new in Denali&amp;gt;&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Memory Node&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Target Node Memory (KB)&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;  
&lt;td style="border:1px solid black;" colspan="2" align="center"&gt;&amp;lt;new in Denali&amp;gt;&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Memory Node&lt;/td&gt;
&lt;td style="border:1px solid black;"&gt;Total Node Memory (KB)&lt;/td&gt;
&lt;/tr&gt;

&lt;/table&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can see that several AWE-related counters have been removed, since AWE is no longer supported in Denali (this means if you are on 32-bit hardware and have &amp;gt; 4GB of RAM, you may as well start shopping for new hardware if you plan to be an early adopter).&amp;nbsp; You'll also notice several Buffer Manager/Node/Partition objects are gone in Denali, replaced by Memory Manager/Node objects (and now measured in KB as opposed to pages).&amp;nbsp; Some of these are described &lt;a href="http://technet.microsoft.com/en-us/library/ff929156%28SQL.110%29.aspx" title="http://technet.microsoft.com/en-us/library/ff929156%28SQL.110%29.aspx" target="_blank"&gt;here&lt;/a&gt;.&amp;nbsp; There are also some new replica counters based on the new availability and HA/DR features in Denali (described &lt;a href="http://msdn.microsoft.com/en-us/library/ff878356%28SQL.110%29.aspx" title="http://msdn.microsoft.com/en-us/library/ff878356%28SQL.110%29.aspx" target="_blank"&gt;here&lt;/a&gt; and &lt;a href="http://msdn.microsoft.com/en-us/library/ff878472%28SQL.110%29.aspx" title="http://msdn.microsoft.com/en-us/library/ff878472%28SQL.110%29.aspx" target="_blank"&gt;here&lt;/a&gt;).&amp;nbsp; The new Log Flush Write Time (ms) counter is described in this BOL topic: &lt;a href="http://msdn.microsoft.com/en-us/library/ms189883%28SQL.110%29.aspx" title="http://msdn.microsoft.com/en-us/library/ms189883%28SQL.110%29.aspx" target="_blank"&gt;SQL Server, Databases Object&lt;/a&gt;.&amp;nbsp; I can't find any information about the InSysXact waits/sec counter; hopefully the documentation will catch up by RTM (or, ideally, by the next CTP). &lt;br&gt;&lt;/p&gt;

&lt;p&gt;So, if you're currently monitoring any of these performance counters in 2008 R2 or previous versions, take note that not only are they changing in Denali, but also that their values can mean something different. &lt;br&gt;&lt;/p&gt;

&lt;p&gt;Now keep in mind that this does not address changes to performance counters that are only present when certain features are enabled, such as database mirroring and replication.&amp;nbsp; I will try to re-run these tests when I have a suitable environment with as many features enabled as possible.&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;br&gt;&lt;/p&gt;</description></item><item><title>SQL Server v.Next (Denali) : Metadata enhancements</title><link>http://sqlblog.com/blogs/aaron_bertrand/archive/2010/12/20/sql-server-v-next-denali-metadata-discovery.aspx</link><pubDate>Mon, 20 Dec 2010 15:09:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:31328</guid><dc:creator>AaronBertrand</dc:creator><description>
&lt;p&gt;In my previous job, we had several cases where schema changes or incorrect developer assumptions in the middle tier or application logic would lead to type mismatches. &amp;nbsp;We would have a stored procedure that returns a BIT column, but then change the procedure to have something like CASE WHEN &amp;lt;condition&amp;gt; THEN 1 ELSE 0 END. &amp;nbsp;In this case SQL Server would return an INT as a catch-all, and if .NET was expecting a boolean, BOOM. &amp;nbsp;Wouldn't it be nice if the application could check the result set of the stored procedure, and construct its data types using that information? &amp;nbsp;Another case would be where the schema has changed, but the applications can't all be updated at once. &amp;nbsp;Wouldn't it be great to be able to tell SQL Server what the column name should be, what data type you want, or in what collation, as part of the stored procedure call? &amp;nbsp;How often have you cursed the bizarre behavior of SET FMTONLY ON? &amp;nbsp;And finally, how many times have you been frustrated by the output of sp_who2, which returns SPID twice - and worse yet, as a CHAR(5) column instead of an INT?&amp;nbsp;&lt;/p&gt;

&lt;p&gt;You can deal with each of these scenarios with some new procedures and dynamic management functions introduced&amp;nbsp;in Denali. &amp;nbsp;We will have new functionality to either discover or control the metadata of queries, without actually having to run them, store temporary results elsewhere, or use SET FMTONLY ON.&lt;br&gt;&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="4"&gt;Some examples&lt;/font&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;b&gt;Inspect output of queries without piecing together catalog views&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Picture a very simple table like this: &lt;br&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;table bgcolor="#eeeeee" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;pre style="padding:10px 20px;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;"&gt;&lt;font color="blue"&gt;CREATE TABLE &lt;/font&gt;&lt;font color="black"&gt;dbo.x&lt;br&gt;&lt;/font&gt;&lt;font color="gray"&gt;(&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;foo&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="blue"&gt;INT &lt;/font&gt;&lt;font color="gray"&gt;NOT NULL,&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;bar&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="blue"&gt;DECIMAL&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;12&lt;/font&gt;&lt;font color="gray"&gt;, &lt;/font&gt;&lt;font color="black"&gt;2&lt;/font&gt;&lt;font color="gray"&gt;),&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;blat&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="blue"&gt;VARCHAR&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;20&lt;/font&gt;&lt;font color="gray"&gt;),&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;mort&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="blue"&gt;NVARCHAR&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;32&lt;/font&gt;&lt;font color="gray"&gt;),&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;splunge &lt;/font&gt;&lt;font color="blue"&gt;NVARCHAR&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="magenta"&gt;MAX&lt;/font&gt;&lt;font color="gray"&gt;),&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;whence&amp;nbsp; &lt;/font&gt;&lt;font&gt;&lt;font color="blue"&gt;DATETIME2&lt;/font&gt;&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;4&lt;/font&gt;&lt;font color="gray"&gt;) NOT NULL&lt;br&gt;);&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/blockquote&gt;

&lt;p&gt;And then a query like this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;table bgcolor="#eeeeee" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;pre style="padding:10px 20px;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;"&gt;&lt;font color="blue"&gt;SELECT &lt;/font&gt;&lt;font color="gray"&gt;* &lt;/font&gt;&lt;font color="blue"&gt;FROM &lt;/font&gt;&lt;font color="black"&gt;dbo.x&lt;/font&gt;&lt;font color="gray"&gt;;&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/blockquote&gt;

&lt;p&gt;Today, if I want the application to understand the data types that are coming back from this query, I would have to create queries against the catalog views sys.columns and sys.types, for example:&lt;br&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;table bgcolor="#eeeeee" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;pre style="padding:10px 20px;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;"&gt;&lt;font color="blue"&gt;SELECT &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;c.name&lt;/font&gt;&lt;font color="gray"&gt;, &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;t.name&lt;/font&gt;&lt;font color="gray"&gt;, &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;c.max_length&lt;/font&gt;&lt;font color="gray"&gt;, &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;c.[precision]&lt;/font&gt;&lt;font color="gray"&gt;, &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;c.scale&lt;/font&gt;&lt;font color="gray"&gt;, &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;c.is_nullable&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;FROM &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font&gt;&lt;font color="green"&gt;sys&lt;/font&gt;&lt;/font&gt;&lt;font color="black"&gt;.&lt;/font&gt;&lt;font&gt;&lt;font color="green"&gt;columns&lt;/font&gt;&lt;/font&gt;&lt;font color="black"&gt; &lt;/font&gt;&lt;font color="blue"&gt;AS &lt;/font&gt;&lt;font color="black"&gt;c&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;INNER JOIN &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font&gt;&lt;font color="green"&gt;sys&lt;/font&gt;&lt;/font&gt;&lt;font color="black"&gt;.&lt;/font&gt;&lt;font&gt;&lt;font color="green"&gt;types&lt;/font&gt;&lt;/font&gt;&lt;font color="black"&gt; &lt;/font&gt;&lt;font color="blue"&gt;AS &lt;/font&gt;&lt;font color="black"&gt;t&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="blue"&gt;ON &lt;/font&gt;&lt;font color="black"&gt;c.system_type_id = &lt;/font&gt;&lt;font color="blue"&gt;&lt;/font&gt;&lt;font color="black"&gt;t.system_type_id&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="gray"&gt;AND &lt;/font&gt;&lt;font color="black"&gt;c.user_type_id  = &lt;/font&gt;&lt;font color="blue"&gt;&lt;/font&gt;&lt;font color="black"&gt;t.user_type_id&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;WHERE &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;c.[object_id] =&lt;/font&gt;&lt;font color="blue"&gt; &lt;/font&gt;&lt;font color="magenta"&gt;OBJECT_ID&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="red"&gt;'dbo.x'&lt;/font&gt;&lt;font color="gray"&gt;)&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;ORDER BY&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;c.column_id&lt;/font&gt;&lt;font color="gray"&gt;;&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/blockquote&gt;

&lt;p&gt;Results:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&amp;nbsp;&lt;img src="http://sqlblog.com/files/folders/31746/download.aspx" width="561" border="1" height="159"&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This leaves some serious gaps, since I have to perform all kinds of manipulations to put these outputs into true data type definitions.&amp;nbsp; For example, I have to check max_length for -1 and switch it to MAX, I have to check for nchar/nvarchar and cut max_length in half, and I have to piece together the precision and scale for *some* numeric- and date-based types.&lt;/p&gt;

&lt;p&gt;There is a new dynamic management function in Denali, sys.dm_exec_describe_first_result_set, which will take a query and produce a much more concise description of the data types coming back in the query.&amp;nbsp; While the function returns other columns, I'll focus on the ones that are most useful for describing resultsets and creating new tables based on them.&lt;/p&gt;

&lt;blockquote&gt;
&lt;table bgcolor="#eeeeee" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;pre style="padding:10px 20px;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;"&gt;&lt;font color="blue"&gt;SELECT &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;name&lt;/font&gt;&lt;font color="gray"&gt;, &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;system_type_name&lt;/font&gt;&lt;font color="gray"&gt;, &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;is_nullable&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;FROM &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font&gt;&lt;font color="green"&gt;sys&lt;/font&gt;&lt;/font&gt;&lt;font color="black"&gt;.&lt;/font&gt;&lt;font&gt;&lt;font color="green"&gt;dm_exec_describe_first_result_set&lt;/font&gt;&lt;/font&gt;&lt;font color="black"&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="gray"&gt;(&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="red"&gt;N'SELECT * FROM dbo.x;'&lt;/font&gt;&lt;font color="gray"&gt;, NULL, &lt;/font&gt;&lt;font color="black"&gt;0&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="gray"&gt;) &lt;/font&gt;&lt;font color="blue"&gt;AS &lt;/font&gt;&lt;font color="black"&gt;f&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;ORDER BY&lt;br&gt;    &lt;/font&gt;&lt;font color="black"&gt;column_ordinal&lt;/font&gt;&lt;font color="gray"&gt;;&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/blockquote&gt;

&lt;p&gt;Results:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;img src="http://sqlblog.com/files/folders/31747/download.aspx" width="350" border="1" height="160"&gt;&amp;nbsp;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Clearly this is a lot less work and manipulation to get the data types consistent - all of the "compound" data types come back exactly as you need to define them.&amp;nbsp; So let's imagine you want to generate CREATE TABLE scripts to store the data from a bunch of DMVs or your own views or other queries; again, you can do this without writing very complex queries against the catalog views or with piecing together the data types manually.&amp;nbsp; A very simple example that generates a CREATE TABLE statement to store the data from sys.dm_exec_sessions in your own repository table:&lt;/p&gt;

&lt;blockquote&gt;
&lt;table bgcolor="#eeeeee" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;pre style="padding:10px 20px;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;"&gt;&lt;font color="blue"&gt;SET NOCOUNT ON&lt;/font&gt;&lt;font color="gray"&gt;;&lt;br&gt;&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;DECLARE &lt;/font&gt;&lt;font color="#434343"&gt;@sql &lt;/font&gt;&lt;font color="blue"&gt;NVARCHAR&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="magenta"&gt;MAX&lt;/font&gt;&lt;font color="gray"&gt;);&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;SET &lt;/font&gt;&lt;font color="#434343"&gt;@sql = &lt;/font&gt;&lt;font color="blue"&gt;&lt;/font&gt;&lt;font color="red"&gt;N'SELECT * FROM sys.dm_exec_sessions;'&lt;/font&gt;&lt;font color="gray"&gt;;&lt;br&gt;&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;SELECT &lt;/font&gt;&lt;font color="red"&gt;'CREATE TABLE dbo.SessionsDMV('&lt;/font&gt;&lt;font color="gray"&gt;;&lt;br&gt;&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;SELECT &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="magenta"&gt;CASE &lt;/font&gt;&lt;font color="black"&gt;column_ordinal &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="blue"&gt;WHEN &lt;/font&gt;&lt;font color="black"&gt;1 &lt;/font&gt;&lt;font color="blue"&gt;THEN &lt;/font&gt;&lt;font color="red"&gt;'' &lt;/font&gt;&lt;font color="blue"&gt;ELSE &lt;/font&gt;&lt;font color="red"&gt;',' &lt;/font&gt;&lt;font color="blue"&gt;END &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="gray"&gt;+ &lt;/font&gt;&lt;font color="black"&gt;name &lt;/font&gt;&lt;font color="gray"&gt;+ &lt;/font&gt;&lt;font color="red"&gt;' ' &lt;/font&gt;&lt;font color="gray"&gt;+ &lt;/font&gt;&lt;font color="black"&gt;system_type_name &lt;/font&gt;&lt;font color="gray"&gt;+ &lt;/font&gt;&lt;font color="magenta"&gt;CASE &lt;/font&gt;&lt;font color="black"&gt;is_nullable &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="blue"&gt;WHEN &lt;/font&gt;&lt;font color="black"&gt;0 &lt;/font&gt;&lt;font color="blue"&gt;THEN &lt;/font&gt;&lt;font color="red"&gt;' not null' &lt;/font&gt;&lt;font color="blue"&gt;ELSE &lt;/font&gt;&lt;font color="red"&gt;'' &lt;/font&gt;&lt;font color="blue"&gt;END&lt;br&gt;FROM &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font&gt;&lt;font color="green"&gt;sys&lt;/font&gt;&lt;/font&gt;&lt;font color="black"&gt;.&lt;/font&gt;&lt;font&gt;&lt;font color="green"&gt;dm_exec_describe_first_result_set&lt;/font&gt;&lt;/font&gt;&lt;br&gt;&lt;font color="black"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="gray"&gt;(&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#434343"&gt;@sql&lt;/font&gt;&lt;font color="gray"&gt;, NULL, &lt;/font&gt;&lt;font color="black"&gt;0&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="gray"&gt;) &lt;/font&gt;&lt;font color="blue"&gt;AS &lt;/font&gt;&lt;font color="black"&gt;f&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;ORDER BY&lt;br&gt;    &lt;/font&gt;&lt;font color="black"&gt;column_ordinal&lt;/font&gt;&lt;font color="gray"&gt;;&lt;br&gt;&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;SELECT &lt;/font&gt;&lt;font color="red"&gt;');'&lt;/font&gt;&lt;font color="gray"&gt;;&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/blockquote&gt;

&lt;p&gt;The results (not exactly how I would want them formatted, but you can play with the query above so the code conforms better to your standards):&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;blockquote&gt;
&lt;table bgcolor="#eeeeee" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;pre style="padding:10px 20px;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;"&gt;-----------------------------&lt;br&gt;CREATE TABLE dbo.SessionsDMV(&lt;br&gt;&lt;br&gt;------------------------------------------------------------------&lt;br&gt;session_id smallint not null&lt;br&gt;,login_time datetime not null&lt;br&gt;,host_name nvarchar(128)&lt;br&gt;,program_name nvarchar(128)&lt;br&gt;,host_process_id int&lt;br&gt;,client_version int&lt;br&gt;,client_interface_name nvarchar(32)&lt;br&gt;,security_id varbinary(85) not null&lt;br&gt;,login_name nvarchar(128) not null&lt;br&gt;,nt_domain nvarchar(128)&lt;br&gt;,nt_user_name nvarchar(128)&lt;br&gt;,status nvarchar(30) not null&lt;br&gt;,context_info varbinary(128)&lt;br&gt;,cpu_time int not null&lt;br&gt;,memory_usage int not null&lt;br&gt;,total_scheduled_time int not null&lt;br&gt;,total_elapsed_time int not null&lt;br&gt;,endpoint_id int not null&lt;br&gt;,last_request_start_time datetime not null&lt;br&gt;,last_request_end_time datetime&lt;br&gt;,reads bigint not null&lt;br&gt;,writes bigint not null&lt;br&gt;,logical_reads bigint not null&lt;br&gt;,is_user_process bit not null&lt;br&gt;,text_size int not null&lt;br&gt;,language nvarchar(128)&lt;br&gt;,date_format nvarchar(3)&lt;br&gt;,date_first smallint not null&lt;br&gt;,quoted_identifier bit not null&lt;br&gt;,arithabort bit not null&lt;br&gt;,ansi_null_dflt_on bit not null&lt;br&gt;,ansi_defaults bit not null&lt;br&gt;,ansi_warnings bit not null&lt;br&gt;,ansi_padding bit not null&lt;br&gt;,ansi_nulls bit not null&lt;br&gt;,concat_null_yields_null bit not null&lt;br&gt;,transaction_isolation_level smallint not null&lt;br&gt;,lock_timeout int not null&lt;br&gt;,deadlock_priority int not null&lt;br&gt;,row_count bigint not null&lt;br&gt;,prev_error int not null&lt;br&gt;,original_security_id varbinary(85) not null&lt;br&gt;,original_login_name nvarchar(128) not null&lt;br&gt;,last_successful_logon datetime&lt;br&gt;,last_unsuccessful_logon datetime&lt;br&gt;,unsuccessful_logons bigint&lt;br&gt;,group_id int not null&lt;br&gt;,authenticating_database_id int&lt;br&gt;&lt;br&gt;----&lt;br&gt;);&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now, you can copy the entire result from the messages pane, and run it to create a table that will accept an INSERT statement like "INSERT dbo.SessionsDMV SELECT * FROM sys.dm_exec_sessions;"&lt;/p&gt;

&lt;p&gt;I'll leave it as an exercise to the reader to try this out against different values of @sql.&lt;/p&gt;

&lt;p&gt;&lt;br&gt;&lt;b&gt;Best guess at undeclared parameters&lt;/b&gt;&amp;nbsp; &lt;/p&gt;

&lt;p&gt;There is also a new stored procedure that will allow you to inspect a T-SQL batch and determine the data types of any undeclared parameters.&amp;nbsp; As an example, what are the data types of the variables that will ultimately be passed into this query text?&amp;nbsp; (This is often something an application developer will have to determine in order to program around these queries.)&lt;/p&gt;

&lt;blockquote&gt;
&lt;table bgcolor="#eeeeee" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;pre style="padding:10px 20px;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;"&gt;&lt;font color="blue"&gt;SELECT &lt;/font&gt;&lt;font color="gray"&gt;* &lt;/font&gt;&lt;font color="blue"&gt;FROM &lt;/font&gt;&lt;font&gt;&lt;font color="green"&gt;sys&lt;/font&gt;&lt;/font&gt;&lt;font color="black"&gt;.&lt;/font&gt;&lt;font&gt;&lt;font color="green"&gt;objects&lt;/font&gt;&lt;/font&gt;&lt;font color="black"&gt; &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="blue"&gt;WHERE &lt;/font&gt;&lt;font color="black"&gt;[object_id] =&lt;/font&gt;&lt;font color="blue"&gt; &lt;/font&gt;&lt;font color="#434343"&gt;@ObjectID&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="gray"&gt;OR (&lt;/font&gt;&lt;font color="black"&gt;name &lt;/font&gt;&lt;font color="gray"&gt;LIKE &lt;/font&gt;&lt;font color="#434343"&gt;@ObjectName&lt;/font&gt;&lt;font color="gray"&gt;);&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/blockquote&gt;

&lt;p&gt;On first glance, most of us will know that the first parameter, @ObjectID, should be declared as an INT, and the second parameter is likely going to be an NVARCHAR(4000).&amp;nbsp; However there is now way for the system to tell us these exact answers with a lot less uncertainty:&lt;/p&gt;

&lt;blockquote&gt;
&lt;table bgcolor="#eeeeee" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;pre style="padding:10px 20px;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;"&gt;&lt;font color="blue"&gt;EXEC &lt;/font&gt;&lt;font&gt;&lt;font color="green"&gt;sys&lt;/font&gt;&lt;/font&gt;&lt;font color="black"&gt;.&lt;/font&gt;&lt;font color="darkred"&gt;sp_describe_undeclared_parameters&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#434343"&gt;@tsql =&lt;/font&gt;&lt;font color="blue"&gt; &lt;/font&gt;&lt;font color="red"&gt;N'SELECT * FROM sys.objects &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;WHERE [object_id] = @ObjectID&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;OR (name LIKE @ObjectName);'&lt;/font&gt;&lt;font color="gray"&gt;;&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/blockquote&gt;

&lt;p&gt;Partial results:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;img src="http://sqlblog.com/files/folders/31748/download.aspx" width="552" border="1" height="68"&gt;&amp;nbsp;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This returns a lot of other columns as well, but even the above should show how the stored procedure will be able to examine large and complicated T-SQL batches and describe all of the parameters that are used.&amp;nbsp; Now, I say "best guess" because the parameter inspection is not perfect - but for most cases it is pretty spot on.&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;br&gt;&lt;b&gt;Convert data types explicitly&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;In this example I am showing a simple stored procedure.&amp;nbsp; If we have two applications that call this stored procedure, we can call the procedure with two different WITH RESULT SETS options in order to return the data differently for the applications, allowing us to slowly change schema across our applications instead of changing them all at once.&amp;nbsp; Imagine the following batch where the first column name is changing from 'Email' to 'Username' (the system no longer requires an e-mail address as the user identifier) and the second column, 'Status,' is changing from an INT to a BIT.&amp;nbsp; The current procedure looks like this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;table bgcolor="#eeeeee" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;pre style="padding:10px 20px;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;"&gt;&lt;font color="blue"&gt;CREATE PROCEDURE &lt;/font&gt;&lt;font color="black"&gt;dbo.Users_GetActiveList&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;AS&lt;br&gt;BEGIN&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;SET NOCOUNT ON&lt;/font&gt;&lt;font color="gray"&gt;;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="blue"&gt;SELECT&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;Username&lt;/font&gt;&lt;font color="gray"&gt;,&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;[Status] =&lt;/font&gt;&lt;font color="blue"&gt; &lt;/font&gt;&lt;font color="magenta"&gt;CASE &lt;/font&gt;&lt;font color="blue"&gt;WHEN &lt;/font&gt;&lt;font color="black"&gt;IsActive = &lt;/font&gt;&lt;font color="blue"&gt;&lt;/font&gt;&lt;font color="black"&gt;1 &lt;/font&gt;&lt;font color="blue"&gt;THEN &lt;/font&gt;&lt;font color="black"&gt;1 &lt;/font&gt;&lt;font color="blue"&gt;ELSE &lt;/font&gt;&lt;font color="black"&gt;0 &lt;/font&gt;&lt;font color="blue"&gt;END&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;FROM &lt;/font&gt;&lt;font color="black"&gt;dbo.Users&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="blue"&gt;ORDER BY &lt;/font&gt;&lt;font color="black"&gt;Username&lt;/font&gt;&lt;font color="gray"&gt;;&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;END&lt;br&gt;GO&lt;/font&gt;&lt;font color="black"&gt;&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/blockquote&gt;

&lt;p&gt;As we prepare for the schema changes, we could change the code above to just say:&lt;/p&gt;

&lt;blockquote&gt;
&lt;table bgcolor="#eeeeee" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;pre style="padding:10px 20px;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;"&gt;&lt;font color="blue"&gt;CREATE PROCEDURE &lt;/font&gt;&lt;font color="black"&gt;dbo.Users_GetActiveList&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;AS&lt;br&gt;BEGIN&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;SET NOCOUNT ON&lt;/font&gt;&lt;font color="gray"&gt;;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="blue"&gt;SELECT&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;Email =&lt;/font&gt;&lt;font color="blue"&gt; &lt;/font&gt;&lt;font color="black"&gt;Username&lt;/font&gt;&lt;font color="gray"&gt;,&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;[Status] = &lt;/font&gt;&lt;font color="blue"&gt;&lt;/font&gt;&lt;font color="magenta"&gt;CONVERT&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font&gt;&lt;font color="blue"&gt;BIT&lt;/font&gt;&lt;/font&gt;&lt;font color="gray"&gt;, &lt;/font&gt;&lt;font color="magenta"&gt;CASE&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;            WHEN &lt;/font&gt;&lt;font color="black"&gt;IsActive =&lt;/font&gt;&lt;font color="blue"&gt; &lt;/font&gt;&lt;font color="black"&gt;1 &lt;/font&gt;&lt;font color="gray"&gt;&amp;lt;&lt;/font&gt;&lt;font color="black"&gt;and other conditions&lt;/font&gt;&lt;font color="gray"&gt;&amp;gt; &lt;/font&gt;&lt;font color="blue"&gt;THEN &lt;/font&gt;&lt;font color="black"&gt;1&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;            ELSE &lt;/font&gt;&lt;font color="black"&gt;0 &lt;/font&gt;&lt;font color="blue"&gt;END&lt;/font&gt;&lt;font color="gray"&gt;)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="blue"&gt;FROM &lt;/font&gt;&lt;font color="black"&gt;dbo.Users&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="blue"&gt;ORDER BY &lt;/font&gt;&lt;font color="black"&gt;Email&lt;/font&gt;&lt;font color="gray"&gt;;&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;END&lt;br&gt;GO&lt;br&gt;&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/blockquote&gt;

&lt;p&gt;But of course unless we update all of our apps at the same time, this change will break at least one of them.&amp;nbsp; Instead, we can use WITH RESULT SETS to change the shape of the resultset conditionally.&amp;nbsp; From the application where we can change the app immediately to use the new column names, we can say:&lt;/p&gt;

&lt;blockquote&gt;
&lt;table bgcolor="#eeeeee" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;pre style="padding:10px 20px;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;"&gt;&lt;font color="blue"&gt;EXECUTE &lt;/font&gt;&lt;font color="black"&gt;dbo.Users_GetActiveList&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;WITH RESULT SETS&lt;/font&gt;&lt;font color="black"&gt;&lt;br&gt;&lt;/font&gt;&lt;font color="gray"&gt;(&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;Email &lt;/font&gt;&lt;font color="blue"&gt;VARCHAR&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;320&lt;/font&gt;&lt;font color="gray"&gt;),&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;[Status] &lt;/font&gt;&lt;font&gt;&lt;font color="blue"&gt;BIT&lt;/font&gt;&lt;/font&gt;&lt;font color="black"&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="gray"&gt;)&lt;br&gt;);&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/blockquote&gt;

&lt;p&gt;In the results, you can't really tell from the screen shot whether Status is a BIT or an INT, but you can certainly see that the Username column has been changed to Email without changing the stored procedure and without having to change all of the consuming apps at once:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;img src="http://sqlblog.com/files/folders/31745/download.aspx" width="289" border="1" height="316"&gt;&amp;nbsp;&lt;/p&gt;
&lt;/blockquote&gt;
The old application can remain unchanged, and continue calling the stored procedure in the default manner - it will still see the Username column, and it will still get Status back as an Int32 instead of a Boolean (we are talking .Net data types here, not SQL).&amp;nbsp; If there really are only two applications, then the WITH RESULT SETS code can be removed from the first application when the schema has changed and the second application has been updated.&amp;nbsp; Otherwise, each app can make use of WITH RESULT SETS until they are all synchronized.&amp;nbsp; At my previous job, I could have used this technique in many scenarios.&lt;/blockquote&gt;

&lt;blockquote&gt;&lt;br&gt;&lt;b&gt;Fix output of system stored procedures&lt;/b&gt;&lt;/blockquote&gt;

&lt;blockquote&gt;Every time I run sp_who2, I cringe. There are two SPID columns for some reason, and both are CHAR(5).&amp;nbsp; Arguably, these could be made SMALLINT, but I think INT plays better with the .NET layer in most cases.&amp;nbsp; There is also a column called BlkBy, which - unlike the rest of the columns - has a name which is unnecessarily truncated.&amp;nbsp; I'll leave this as a CHAR(5) because I know the "." result is appreciated by a lot of people (it lets the true numeric values stand out better than 0 or NULL would).&amp;nbsp; That all said, here is an example of using WITH RESULT SETS to make the output more consumable:
&lt;blockquote&gt;
&lt;table bgcolor="#eeeeee" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;pre style="padding:10px 20px;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;"&gt;&lt;font color="blue"&gt;EXECUTE &lt;/font&gt;&lt;font color="black"&gt;[master]..&lt;/font&gt;&lt;font color="darkred"&gt;sp_who&lt;/font&gt;&lt;font color="black"&gt;2&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;WITH RESULT SETS&lt;/font&gt;&lt;font color="black"&gt;&lt;br&gt;&lt;/font&gt;&lt;font color="gray"&gt;(&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;[SPID]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="blue"&gt;INT&lt;/font&gt;&lt;font color="gray"&gt;,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="green"&gt;-- &amp;lt;-- fixed the data type&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;[Status]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="blue"&gt;NVARCHAR&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;32&lt;/font&gt;&lt;font color="gray"&gt;),&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;[Login]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="blue"&gt;SYSNAME&lt;/font&gt;&lt;font color="gray"&gt;,&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;HostName&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="blue"&gt;SYSNAME&lt;/font&gt;&lt;font color="gray"&gt;,&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;Blocker&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="blue"&gt;CHAR&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;5&lt;/font&gt;&lt;font color="gray"&gt;),&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="green"&gt;-- &amp;lt;-- renamed this column&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;[Database]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="blue"&gt;SYSNAME&lt;/font&gt;&lt;font color="gray"&gt;,&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;Command&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="blue"&gt;NVARCHAR&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;32&lt;/font&gt;&lt;font color="gray"&gt;),&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;CPUTime&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="blue"&gt;VARCHAR&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;30&lt;/font&gt;&lt;font color="gray"&gt;),&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;DiskIO&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="blue"&gt;VARCHAR&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;30&lt;/font&gt;&lt;font color="gray"&gt;),&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;LastBatch&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="blue"&gt;VARCHAR&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;48&lt;/font&gt;&lt;font color="gray"&gt;),&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;ProgramName&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="blue"&gt;NVARCHAR&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;255&lt;/font&gt;&lt;font color="gray"&gt;),&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;Redundant_SPID &lt;/font&gt;&lt;font color="blue"&gt;INT&lt;/font&gt;&lt;font color="gray"&gt;,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="green"&gt;-- &amp;lt;-- renamed this column&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;RequestID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="blue"&gt;INT&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="gray"&gt;)&lt;br&gt;);&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;b&gt;&lt;br&gt;Make more usable output in Management Studio&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;In Denali there is a new system stored procedure called &lt;a href="http://msdn.microsoft.com/en-us/library/ff878233%28SQL.110%29.aspx" title="http://msdn.microsoft.com/en-us/library/ff878233(SQL.110).aspx" target="_blank"&gt;sys.sp_server_diagnostics&lt;/a&gt;, which returns some core system health metrics in XML format.&amp;nbsp; Unfortunately, the implementation returns this data as string rather than XML data, which means the output is pretty useless in Management Studio - you either have to expand the result column and scroll horizontally forever in results to grid mode, or do all kinds of juggling to figure out where each row ends in results to text mode.&amp;nbsp; (I complained about this in &lt;a href="http://connect.microsoft.com/SQLServer/feedback/details/625262/denali-engine-sys-sp-server-diagnostics-should-return-xml-data-as-xml" title="http://connect.microsoft.com/SQLServer/feedback/details/625262/denali-engine-sys-sp-server-diagnostics-should-return-xml-data-as-xml" target="_blank"&gt;Connect #625262&lt;/a&gt;, but they didn't seem to agree with my reasoning - though I'm curious what other data type they think the output may change to in the future.)&amp;nbsp; In order to make the output more useful, we can do the following to convert the last column to XML, making it clickable within SSMS grid results:&lt;/p&gt;

&lt;blockquote&gt;
&lt;table bgcolor="#eeeeee" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;pre style="padding:10px 20px;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;"&gt;&lt;font color="blue"&gt;EXECUTE &lt;/font&gt;&lt;font&gt;&lt;font color="green"&gt;sys&lt;/font&gt;&lt;/font&gt;&lt;font color="black"&gt;.&lt;/font&gt;&lt;font color="black"&gt;&lt;/font&gt;&lt;font color="darkred"&gt;sp_server_diagnostics&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;WITH RESULT SETS&lt;/font&gt;&lt;font color="black"&gt;&lt;br&gt;&lt;/font&gt;&lt;font color="gray"&gt;(&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;create_time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="blue"&gt;DATETIME&lt;/font&gt;&lt;font color="gray"&gt;,&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;component_name &lt;/font&gt;&lt;font color="blue"&gt;VARCHAR&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;20&lt;/font&gt;&lt;font color="gray"&gt;)&lt;/font&gt;&lt;font color="gray"&gt;,&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;[state]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="blue"&gt;INT&lt;/font&gt;&lt;font color="gray"&gt;,&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;state_desc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="blue"&gt;VARCHAR&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;20&lt;/font&gt;&lt;font color="gray"&gt;),&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;data&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="blue"&gt;XML&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="gray"&gt;)&lt;br&gt;);&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/blockquote&gt;

&lt;p&gt;In the results, we can now click on the data column in any row, and it will open a new XML document that is much easier to read and parse: &lt;/p&gt;

&lt;blockquote&gt;&lt;img src="http://sqlblog.com/files/folders/31744/download.aspx" width="687" border="1" height="158"&gt;&lt;br&gt; &lt;br&gt;&lt;/blockquote&gt;

&lt;p&gt;&lt;b&gt;Changing the output collation&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;This one is late to the party but since publishing I felt this nagging feeling that the article was incomplete.&amp;nbsp; I can't think of an obvious and practical use for this off the top of my head, as thankfully I have not been exposed to too many collation issues over the years.&amp;nbsp; But if a query is outputting a column in a certain collation, you can override that collation using WITH RESULT SETS.&amp;nbsp; Here is an example that changes Albanian_BIN to Albanian_100_BIN, and I pass this batch to the DMV just to show that the output collation is obeyed:&lt;br&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;table bgcolor="#eeeeee" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;pre style="padding:10px 20px;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;"&gt;&lt;font color="blue"&gt;DECLARE &lt;/font&gt;&lt;font color="#434343"&gt;@sql &lt;/font&gt;&lt;font color="blue"&gt;NVARCHAR&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="magenta"&gt;MAX&lt;/font&gt;&lt;font color="gray"&gt;);&lt;br&gt;&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;SET &lt;/font&gt;&lt;font color="#434343"&gt;@sql = &lt;/font&gt;&lt;font color="blue"&gt;&lt;/font&gt;&lt;font color="red"&gt;N'EXEC(''SELECT N''''foo'''' COLLATE Albanian_BIN'')&lt;br&gt;&amp;nbsp;&amp;nbsp;WITH RESULT SETS&lt;br&gt;  (&lt;br&gt;    (&lt;br&gt;      foo NVARCHAR(32) COLLATE Albanian_100_BIN&lt;br&gt;    )&lt;br&gt;  );'&lt;/font&gt;&lt;font color="gray"&gt;;&lt;br&gt;&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;SELECT &lt;/font&gt;&lt;font color="black"&gt;name&lt;/font&gt;&lt;font color="gray"&gt;, &lt;/font&gt;&lt;font color="black"&gt;collation_name&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="blue"&gt;FROM &lt;/font&gt;&lt;font&gt;&lt;font color="green"&gt;sys&lt;/font&gt;&lt;/font&gt;&lt;font color="black"&gt;.&lt;/font&gt;&lt;font&gt;&lt;font color="green"&gt;dm_exec_describe_first_result_set&lt;br&gt;    &lt;/font&gt;&lt;/font&gt;&lt;font color="gray"&gt;(&lt;br&gt;        &lt;/font&gt;&lt;font color="#434343"&gt;@sql&lt;/font&gt;&lt;font color="gray"&gt;, NULL, &lt;/font&gt;&lt;font color="black"&gt;0&lt;br&gt;    &lt;/font&gt;&lt;font color="gray"&gt;);&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/blockquote&gt;
&lt;p&gt;Results:&lt;/p&gt;
&lt;blockquote&gt;&lt;img src="http://sqlblog.com/files/folders/31852/download.aspx"&gt;&lt;br&gt;&lt;/blockquote&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Easier translation in SSIS&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Finally, here is a blog post from fellow MVP James Rowland-Jones, where he demonstrates how EXECUTE ... WITH RESULT SETS can be very handy in SSIS: &lt;br&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="http://consultingblogs.emc.com/jamesrowlandjones/archive/2010/11/16/denali-using-execute-with-result-sets-example-using-ssis-source-adaptors.aspx" title="http://consultingblogs.emc.com/jamesrowlandjones/archive/2010/11/16/denali-using-execute-with-result-sets-example-using-ssis-source-adaptors.aspx" target="_blank"&gt;Denali - Using EXECUTE WITH RESULT SETS (example using SSIS Source Adaptors)&lt;/a&gt; &lt;br&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;br&gt;&lt;font size="4"&gt;Caveats&lt;/font&gt; &lt;br&gt;&lt;/p&gt;

&lt;p&gt;The DMVs and stored procedures for describing result sets are currently written to only inspect the *first* result set.&amp;nbsp; So for something like sp_help, it will only assist in determining the very first set of output.&amp;nbsp; I suspect they will correct this in the future, and am thankful they named the objects in an unambiguous way.&lt;/p&gt;

&lt;p&gt;In addition, there are certain types of batches that will simply return an error when you try to examine them.&amp;nbsp; For example, while a batch with a table variable can be passed to sys.sp_describe_first_result_set, a batch with a temp table cannot: &lt;br&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;table bgcolor="#eeeeee" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;pre style="padding:10px 20px;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;"&gt;&lt;font color="blue"&gt;EXEC &lt;/font&gt;&lt;font&gt;&lt;font color="green"&gt;sys&lt;/font&gt;&lt;/font&gt;&lt;font color="black"&gt;.&lt;/font&gt;&lt;font color="darkred"&gt;sp_describe_first_result_set &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="#434343"&gt;@tsql =&lt;/font&gt;&lt;font color="blue"&gt; &lt;/font&gt;&lt;font color="red"&gt;N'CREATE TABLE #y (j INT);SELECT j FROM #y;'&lt;/font&gt;&lt;font color="gray"&gt;;&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/blockquote&gt;

&lt;p&gt;Results:&lt;/p&gt;

&lt;blockquote&gt;
&lt;table bgcolor="#eeeeee" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;&lt;div style="padding:10px 20px;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;color:red;"&gt;Msg 11525, Level 16, State 1, Procedure sp_describe_first_result_set, Line 1&lt;br&gt;The metadata could not be determined because statement 'SELECT j FROM #y;' uses a temp table.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/blockquote&gt;

&lt;p&gt;WITH RESULT SETS requires a double-nesting of parentheses.&amp;nbsp; If you try the following:&lt;/p&gt;

&lt;blockquote&gt;
&lt;table bgcolor="#eeeeee" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;pre style="padding:10px 20px;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;"&gt;&lt;font color="blue"&gt;EXECUTE &lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="red"&gt;'SELECT foo = N''bar'';'&lt;/font&gt;&lt;font color="gray"&gt;)&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;WITH RESULT SETS&lt;/font&gt;&lt;font color="black"&gt;&lt;br&gt;&lt;/font&gt;&lt;font color="gray"&gt;(&lt;br&gt;&lt;/font&gt;&lt;font color="green"&gt;-- (&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color="black"&gt;foo &lt;/font&gt;&lt;font color="blue"&gt;NVARCHAR&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;3&lt;/font&gt;&lt;font color="gray"&gt;)&lt;br&gt;&lt;/font&gt;&lt;font color="green"&gt;-- )&lt;br&gt;&lt;/font&gt;&lt;font color="gray"&gt;);&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/blockquote&gt;

&lt;p&gt;Results:&lt;/p&gt;

&lt;blockquote&gt;
&lt;table bgcolor="#eeeeee" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;&lt;div style="padding:10px 20px;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;color:red;"&gt;Msg 102, Level 15, State 1, Line 4&lt;br&gt;Incorrect syntax near 'foo'.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/blockquote&gt;

&lt;p&gt;To get around this, you will need to un-comment the commented parentheses.&amp;nbsp; The reason is that WITH RESULT SETS is plural; you can dictate the shape of multiple result sets, as demonstrated above.&lt;br&gt;&lt;/p&gt;

&lt;p&gt;Also note that you can't use WITH RESULTS to add or remove columns from the output; you can only mess with the column names, data types, nullability and collation.&amp;nbsp; So for example, if you try to eliminate columns from the result set as follows:&lt;/p&gt;

&lt;blockquote&gt;
&lt;table bgcolor="#eeeeee" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;pre style="padding:10px 20px;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;"&gt;&lt;font color="blue"&gt;EXECUTE &lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="red"&gt;'SELECT foo = N''bar'', x = 1;'&lt;/font&gt;&lt;font color="gray"&gt;)&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;WITH RESULT SETS&lt;/font&gt;&lt;font color="black"&gt;&lt;br&gt;&lt;/font&gt;&lt;font color="gray"&gt;(&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(&lt;/font&gt;&lt;font color="black"&gt;foo &lt;/font&gt;&lt;font color="blue"&gt;NVARCHAR&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;3&lt;/font&gt;&lt;font color="gray"&gt;))&lt;br&gt;);&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/blockquote&gt;

&lt;p&gt;Results: &lt;/p&gt;

&lt;blockquote&gt;
&lt;table bgcolor="#eeeeee" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;&lt;div style="padding:10px 20px;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;color:red;"&gt;Msg 11537, Level 16, State 1, Line 1&lt;br&gt;EXECUTE statement failed because its WITH RESULT SETS clause specified 1 column(s) for result set number 1, but the statement sent 2 column(s) at run time.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/blockquote&gt;

&lt;p&gt;And if you try to convert to an incompatible data type, it will fail at runtime.&amp;nbsp; For example, the following code will compile, but if you run it:&lt;/p&gt;

&lt;blockquote&gt;
&lt;table bgcolor="#eeeeee" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;pre style="padding:10px 20px;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;"&gt;&lt;font color="blue"&gt;EXECUTE &lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="red"&gt;'SELECT foo = N''bar'';'&lt;/font&gt;&lt;font color="gray"&gt;)&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;WITH RESULT SETS&lt;/font&gt;&lt;font color="black"&gt;&lt;br&gt;&lt;/font&gt;&lt;font color="gray"&gt;(&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(&lt;/font&gt;&lt;font color="black"&gt;foo &lt;/font&gt;&lt;font color="blue"&gt;INT&lt;/font&gt;&lt;font color="gray"&gt;)&lt;br&gt;);&lt;/font&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/blockquote&gt;

&lt;p&gt;Results:&lt;/p&gt;

&lt;blockquote&gt;
&lt;table bgcolor="#eeeeee" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;&lt;div style="padding:10px 20px;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;color:red;"&gt;Msg 8114, Level 16, State 2, Line 1&lt;br&gt;Error converting data type varchar to int.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/blockquote&gt;
There are many other limitations and caveats to using these metadata enhancements; if you can see usefulness in some of these capabilities, I strongly recommend reviewing the official documentation and playing with the features for yourself.&lt;br&gt;
&lt;p&gt;&lt;br&gt;&lt;font size="4"&gt;Official links&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;Here are links to the official documentation about these new features: &lt;br&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;sys.sp_describe_first_result_set&lt;br&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ff878602%28SQL.110%29.aspx" title="http://msdn.microsoft.com/en-us/library/ff878602(SQL.110).aspx" target="_blank"&gt;http://msdn.microsoft.com/en-us/library/ff878602(SQL.110).aspx&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;sys.sp_describe_undeclared_parameters&lt;br&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ff878260%28SQL.110%29.aspx" title="http://msdn.microsoft.com/en-us/library/ff878260(SQL.110).aspx" target="_blank"&gt;http://msdn.microsoft.com/en-us/library/ff878260(SQL.110).aspx&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;sys.dm_exec_describe_first_result_set_for_object&lt;br&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ff878236%28SQL.110%29.aspx" title="http://msdn.microsoft.com/en-us/library/ff878236(SQL.110).aspx" target="_blank"&gt;http://msdn.microsoft.com/en-us/library/ff878236(SQL.110).aspx&lt;/a&gt;&lt;br&gt;&lt;br&gt;sys.dm_exec_describe_first_result_set&lt;br&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ff878258%28SQL.110%29.aspx" title="http://msdn.microsoft.com/en-us/library/ff878258(SQL.110).aspx" target="_blank"&gt;http://msdn.microsoft.com/en-us/library/ff878258(SQL.110).aspx&lt;/a&gt;&lt;br&gt;&lt;/p&gt;

&lt;p&gt;EXECUTE&lt;br&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms188332%28SQL.110%29.aspx" title="http://msdn.microsoft.com/en-us/library/ms188332(SQL.110).aspx" target="_blank"&gt;http://msdn.microsoft.com/en-us/library/ms188332(SQL.110).aspx&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;br&gt;</description></item><item><title>Slide Deck &amp;amp; Demos : Charlotte SQL Server User Group, 2010-12-15</title><link>http://sqlblog.com/blogs/aaron_bertrand/archive/2010/12/15/slide-deck-demos-charlotte-sql-server-user-group-2010-12-15.aspx</link><pubDate>Thu, 16 Dec 2010 03:57:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:31588</guid><dc:creator>AaronBertrand</dc:creator><description>On Wednesday I presented my "What's New in Denali" presentation in Charlotte, NC. &amp;nbsp;Attached is a .zip file containing the PowerPoint presentation, as well as the scripts used in the demos and some sample snippet XML files.</description></item></channel></rss>