<?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>SSIS Junkie : sql server</title><link>http://sqlblog.com/blogs/jamie_thomson/archive/tags/sql+server/default.aspx</link><description>Tags: sql server</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>AdventureWorks on Azure donates GBP351.49 to War Child. THANK YOU!</title><link>http://sqlblog.com/blogs/jamie_thomson/archive/2013/04/07/adventureworks-on-azure-donates-gbp351-49-to-war-child-thank-you.aspx</link><pubDate>Sun, 07 Apr 2013 21:02:35 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:48563</guid><dc:creator>jamiet</dc:creator><slash:comments>0</slash:comments><comments>http://sqlblog.com/blogs/jamie_thomson/comments/48563.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/jamie_thomson/commentrss.aspx?PostID=48563</wfw:commentRss><wfw:comment>http://sqlblog.com/blogs/jamie_thomson/rsscomments.aspx?PostID=48563</wfw:comment><description>&lt;p&gt;Just over 12 months ago I published a blog post entitled &lt;a title="http://sqlblog.com/blogs/jamie_thomson/archive/2012/03/27/adventureworks2012-now-available-to-all-on-sql-azure.aspx" href="http://sqlblog.com/blogs/jamie_thomson/archive/2012/03/27/adventureworks2012-now-available-to-all-on-sql-azure.aspx" target="_blank"&gt;AdventureWorks2012 now available for all on SQL Azure&lt;/a&gt;. In it I explained that I had set up a Windows Azure SQL Database (then known as SQL Azure database) for the SQL Server community to use and hence familiarise themselves with the SQL Azure offering – I called this initiative “AdventureWorks on Azure”. Judging by the comments that were left in the table that I set up for that very purpose it seems that a number of people were in favour and made use of it:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_5562FC2B.png"&gt;&lt;img title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;display:inline;padding-right:0px;" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_0B184186.png" width="844" height="452" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;The credentials to enable you to connect up and leave your own comment are in that &lt;/em&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/archive/2012/03/27/adventureworks2012-now-available-to-all-on-sql-azure.aspx" target="_blank"&gt;&lt;em&gt;same blog post&lt;/em&gt;&lt;/a&gt;&lt;em&gt;!&lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Running a SQL Azure database is of course not free hence I asked for the community to support the initiative by &lt;a href="http://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;amp;business=adventureworksazure@hotmail.co.uk&amp;amp;item_name=Supporting%20the%20SQL%20community" target="_blank"&gt;contributing via PayPal&lt;/a&gt; to its upkeep. I hoped that there might be enough left over to make a charitable donation and as you have probably gathered from the title of this blog post I’m delighted to be able to say that that did indeed happen. A few minutes ago I made a contribution to &lt;a href="http://www.warchild.org.uk/" target="_blank"&gt;War Child&lt;/a&gt; (the same charity that the &lt;a href="http://manning.com/nielsen/" target="_blank"&gt;SQL Server MVP Deep Dives book&lt;/a&gt; donated to) of £351.49&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_218AE00D.png"&gt;&lt;img title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;display:inline;padding-right:0px;" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_607C60A8.png" width="431" height="349" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;What do War Child do? In their own words:&lt;/p&gt;  &lt;blockquote&gt;   &lt;h3&gt;&lt;font color="#c0504d"&gt;We look forward to a world in which children's lives aren't torn apart by war.&lt;/font&gt;&lt;/h3&gt;    &lt;p&gt;&lt;font color="#c0504d"&gt;There's 27 of us in an old false-teeth factory in north London.       &lt;br /&gt;We're trying to change the world.&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font color="#c0504d"&gt;You could say we're a small charity with big ambitions. &lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font color="#c0504d"&gt;We're directly transforming the lives of tens of thousands of children. And we're campaigning to improve the lives of millions more. &lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Thank you to everyone that made a donation especially to the extremely generous person (who shall remain nameless – you know who you are) that contributed $105.&lt;/p&gt;  &lt;p&gt;   &lt;hr /&gt;I would like to keep AdventureWorks on Azure going for another year at least but to do that I need more donations. If you would like to support this initiative for another year take a read of the instructions below that I have copied from last year’s blog post:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;AdventureWorks on Azure is being provided for the SQL Server community to use and so I am hoping that that same community will rally around to support this effort by making a voluntary donation to support the upkeep which, going on &lt;a href="https://www.windowsazure.com/en-us/pricing/details/#database/?WT.mc_id=cmp_pst001_blg_post0055pri"&gt;current pricing&lt;/a&gt;, is going to be $119.88 per year. If you would like to contribute to keep AdventureWorks on Azure up and running for that full year please &lt;a href="http://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;amp;business=adventureworksazure@hotmail.co.uk&amp;amp;item_name=Supporting%20the%20SQL%20community"&gt;donate via PayPal&lt;/a&gt; to adventureworksazure@hotmail.co.uk:&lt;/p&gt;    &lt;p&gt;&lt;a href="http://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;amp;business=adventureworksazure@hotmail.co.uk&amp;amp;item_name=Supporting%20the%20SQL%20community"&gt;&lt;img src="http://jamiekt.files.wordpress.com/2012/03/paypal_sendmoney.png" /&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;Any amount, no matter how small, will help.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Thank you once again to everyone that donated!&lt;/p&gt;  &lt;p&gt;&lt;a href="http://twitter.com/jamiet" target="_blank"&gt;@Jamiet&lt;/a&gt;&lt;/p&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=48563" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/AdventureWorks+on+Azure/default.aspx">AdventureWorks on Azure</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/AdventureWorksAzure/default.aspx">AdventureWorksAzure</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/sql+server/default.aspx">sql server</category></item><item><title>Connected development in SSDT versus SSMS</title><link>http://sqlblog.com/blogs/jamie_thomson/archive/2013/03/19/connected-development-in-ssdt-versus-ssms.aspx</link><pubDate>Tue, 19 Mar 2013 16:28:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:48314</guid><dc:creator>jamiet</dc:creator><slash:comments>11</slash:comments><comments>http://sqlblog.com/blogs/jamie_thomson/comments/48314.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/jamie_thomson/commentrss.aspx?PostID=48314</wfw:commentRss><wfw:comment>http://sqlblog.com/blogs/jamie_thomson/rsscomments.aspx?PostID=48314</wfw:comment><description>&lt;p&gt;When you install the database projects template of SSDT you get SQL Server Object Explorer (SSOX) installed as well. SSOX is a pane within Visual Studio and is the main enabler of the Connected Development experience that the SSDT team have attempted to provide.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/SNAGHTML15dc3f62_18DB391E.png"&gt;&lt;img title="SNAGHTML15dc3f62" style="border-top:0px;border-right:0px;border-bottom:0px;border-left:0px;display:inline;" border="0" alt="SNAGHTML15dc3f62" width="335" height="118" src="http://sqlblog.com/blogs/jamie_thomson/SNAGHTML15dc3f62_thumb_0C6D15F5.png"&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;SSOX provides some really cool capabilities that are not in SQL Server Management Studio (I hope to blog about them in the near future). In theory these capabilities make it possible for a database developer to spend all their time in SSDT (i.e. Visual Studio) thus making SSMS a pureplay DBA tool (this does of course depend on your definition of both a database developer and a DBA, but I’m not getting into that debate here).&lt;/p&gt;  &lt;p&gt;With that in mind I have spent a few days trying to work without SSMS, preferring to live wholly inside Visual Studio instead. By and large I was able to do everything I needed to do from within Visual Studio however there were a few nuances about the experience that kept pushing me back to SSMS, I detail those nuances below.&lt;/p&gt;  &lt;p&gt;&amp;nbsp;&lt;/p&gt;  &lt;hr&gt;  &lt;h3&gt;Server groups&lt;/h3&gt;  &lt;p&gt;SSOX combines the functions of SSMS’s Object Explorer and Registered Servers pane. I don’t mind either way of working but it does mean that there is no ability to group servers in SSOX like you can in the Registered Servers pane&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_568820DA.png"&gt;&lt;img title="image" style="border-left-width:0px;border-right-width:0px;border-bottom-width:0px;display:inline;border-top-width:0px;" border="0" alt="image" width="244" height="97" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_4E907E78.png"&gt;&lt;/a&gt;&amp;nbsp;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_0977B142.png"&gt;&lt;img title="image" style="border-left-width:0px;border-right-width:0px;border-bottom-width:0px;display:inline;border-top-width:0px;" border="0" alt="image" width="244" height="230" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_6C8E8C6C.png"&gt;&lt;/a&gt; &lt;/p&gt;  &lt;h3&gt;F6&lt;/h3&gt;  &lt;p&gt;In SSMS I regularly use the F6 keyboard shortcut to jump between the query, results &amp;amp; messages panes of a query window. No such keyboard shortcut exists in SSDT and they’ve already canned &lt;a target="_blank" href="https://connect.microsoft.com/sqlserver/feedback/details/780990/ssdt-f6-to-move-between-panes-in-a-query-window#tabs"&gt;my request on Connect to get this fixed&lt;/a&gt; (even though it laughably has status “closed as fixed”).&lt;/p&gt;  &lt;p&gt;&amp;nbsp;&lt;i&gt;UPDATE: See the comments below where Brett Gerhardi informed me of a different keyboard shortcut that does the same thing as F6. Actually its not quite the same, if you have multiple resultsets in your results pane then the behaviour is slightly different to F6 in SSMS - but that's not an issue you'll hot frequently.&lt;/i&gt;&lt;/p&gt;  &lt;h3&gt;Change Connection&lt;/h3&gt;  &lt;p&gt;The context menu in SSMS provides the ability to change a connection as well as connect and disconnect:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_72693005.png"&gt;&lt;img title="image" style="border-left-width:0px;border-right-width:0px;border-bottom-width:0px;display:inline;border-top-width:0px;" border="0" alt="image" width="546" height="115" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_11ABD6D9.png"&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;SSDT doesn’t have change connection and believe me, you don’t know how much you use a feature until its not there:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_09B43477.png"&gt;&lt;img title="image" style="border-left-width:0px;border-right-width:0px;border-bottom-width:0px;display:inline;border-top-width:0px;" border="0" alt="image" width="438" height="58" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_28F6DB4A.png"&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;There’s also no hotkey to jump to “Connection” on the context menu like there is in SSMS (“C”) and I find that annoying too.&lt;/p&gt;  &lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;hr&gt;Those were the main annoyances that forced me back to SSMS. The lack of F6 was a major bugbear for me as I am a big keyboard shortcut junkie. If such things don’t bother you then you may be able to live in Visual Studio quite happily. If you have any similar experiences to share I’d be keen to read them.&lt;p&gt;&amp;nbsp;&lt;/p&gt;  &lt;p&gt;&lt;a target="_blank" href="http://twitter.com/jamiet"&gt;@Jamiet&lt;/a&gt;&lt;/p&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=48314" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/sql+server/default.aspx">sql server</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/SQL+Server+2012/default.aspx">SQL Server 2012</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/SQL+Server+Data+Tools/default.aspx">SQL Server Data Tools</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/SQL+Server+Object+Explorer/default.aspx">SQL Server Object Explorer</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/SSDT/default.aspx">SSDT</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/SSOX/default.aspx">SSOX</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/Visual+Studio/default.aspx">Visual Studio</category></item><item><title>sp_ssiscatalog v1.0.2.0 now available for download [SSIS]</title><link>http://sqlblog.com/blogs/jamie_thomson/archive/2013/03/12/sp-ssiscatalog-v1-0-2-0-now-available-for-download.aspx</link><pubDate>Mon, 11 Mar 2013 22:51:20 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:48182</guid><dc:creator>jamiet</dc:creator><slash:comments>3</slash:comments><comments>http://sqlblog.com/blogs/jamie_thomson/comments/48182.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/jamie_thomson/commentrss.aspx?PostID=48182</wfw:commentRss><wfw:comment>http://sqlblog.com/blogs/jamie_thomson/rsscomments.aspx?PostID=48182</wfw:comment><description>&lt;h2&gt;v1.0.2.0 – what’s in it?&lt;/h2&gt;  &lt;p&gt;Things have been a bit quiet on the sp_ssiscatalog front since &lt;a href="http://sqlblog.com/blogs/jamie_thomson/archive/2012/12/05/documenting-sp-ssiscatalog.aspx" target="_blank"&gt;I last blogged about it three months ago in December 2012&lt;/a&gt;. Rest-assured development continues apace however and today I’m making available a minor update, v1.0.2.0 which is now available for download &lt;a href="http://ssisreportingpack.codeplex.com/releases/view/103261" target="_blank"&gt;from Codeplex&lt;/a&gt;. For those that don’t know I describe sp_ssiscatalog as:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;sp_ssiscatalog is a stored procedure that makes it easy to query for information that is strewn around the SSIS Catalog.&lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;There aren’t too many functional changes in this release, it is more focused on making sp_ssiscatalog easier to use. Back in &lt;a title="http://sqlblog.com/blogs/jamie_thomson/archive/2012/12/05/documenting-sp-ssiscatalog.aspx" href="http://sqlblog.com/blogs/jamie_thomson/archive/2012/12/05/documenting-sp-ssiscatalog.aspx" target="_blank"&gt;Documenting sp_ssiscatalog&lt;/a&gt; I explained how I was adding documentation to the messages tab of SSMS. Hence as of this new release when you execute sp_ssiscatalog you will see information such as this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_446C89A2.png"&gt;&lt;img title="image" style="border-left-width:0px;border-right-width:0px;background-image:none;border-bottom-width:0px;padding-top:0px;padding-left:0px;display:inline;padding-right:0px;border-top-width:0px;" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_5021D0D4.png" width="888" height="344" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_599A8F4A.png"&gt;&lt;img title="image" style="border-left-width:0px;border-right-width:0px;background-image:none;border-bottom-width:0px;padding-top:0px;padding-left:0px;display:inline;padding-right:0px;border-top-width:0px;" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_05D7162F.png" width="890" height="266" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;which I think should be very useful for anyone that wants to use sp_ssiscatalog to its fullest. Even I who wrote the thing and has been using it day-in, day-out for quite some time now can’t remember the names of all the parameters – now I no longer have to!&lt;/p&gt;  &lt;p&gt;Note that you can turn off the display of the documentation using the @show_docs parameter:&lt;/p&gt;  &lt;blockquote&gt;   &lt;pre style="list-style-type:disc;font-family:;background:white;color:;text-align:left;"&gt;&lt;font face="Consolas"&gt;&lt;font size="4"&gt;&lt;strong&gt;&lt;font size="2"&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;exec&lt;/font&gt;&lt;/span&gt; sp_ssiscatalog&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;#160;&lt;/font&gt;&lt;/span&gt;@show_docs&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;=&lt;/font&gt;&lt;/span&gt;0&lt;/font&gt;&lt;/strong&gt;
&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you want to display &lt;em&gt;only&lt;/em&gt; the documentation and not actually have sp_ssiscatalog do any querying of the SSIS Catalog its @show_docs_only:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre style="list-style-type:disc;font-family:;background:white;color:;text-align:left;"&gt;&lt;font face="Consolas"&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;strong&gt;exec&lt;/strong&gt;&lt;/font&gt;&lt;/span&gt;&lt;strong&gt;&lt;font size="2"&gt; sp_ssiscatalog&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;#160;&lt;/font&gt;&lt;/span&gt;@show_docs_only&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;=&lt;/font&gt;&lt;/span&gt;1&lt;/font&gt;&lt;/strong&gt;
&lt;/font&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you have any suggestions for future enhancements please put them in the comments below or submit them to &lt;a href="http://ssisreportingpack.codeplex.com/discussions" target="_blank"&gt;the discussions page on the Codeplex site&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;As a reminder, here is the sort of thing you can do with sp_ssiscatalog:&lt;/p&gt;

&lt;pre style="list-style-type:disc;font-family:;background:white;color:;text-align:left;"&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;span style="color:;"&gt;&lt;font color="#008000"&gt;&lt;strong&gt;--Return all failed executions&amp;#160; &lt;/strong&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/font&gt;&lt;font size="2"&gt;&lt;strong&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;EXEC&lt;/font&gt;&lt;/span&gt; [dbo]&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;[sp_ssiscatalog]&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;#160;&lt;/font&gt;&lt;/span&gt;@operation_type&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;=&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#ff0000"&gt;'execs'&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;@execs_status_desc&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;=&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#ff0000"&gt;'failed'&lt;/font&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;pre style="list-style-type:disc;font-family:;background:white;color:;text-align:left;"&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;strong&gt;&lt;span style="color:;"&gt;&lt;font color="#ff0000"&gt;&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#008000"&gt;--Return all executions for a specified folder&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;EXEC&lt;/font&gt;&lt;/span&gt; [dbo]&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;[sp_ssiscatalog]&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;#160;&lt;/font&gt;&lt;/span&gt;@operation_type&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;=&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#ff0000"&gt;'execs'&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;@execs_folder_name&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;=&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#ff0000"&gt;'My folder'&lt;/font&gt;&lt;/span&gt;&amp;#160; &lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;pre style="list-style-type:disc;font-family:;background:white;color:;text-align:left;"&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;strong&gt;
&lt;span style="color:;"&gt;&lt;font color="#008000"&gt;--Return all executions of a specified package in a specified project&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;EXEC&lt;/font&gt;&lt;/span&gt; [dbo]&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;[sp_ssiscatalog]&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;#160;&lt;/font&gt;&lt;/span&gt;@operation_type&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;=&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#ff0000"&gt;'execs'&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;@execs_project_name&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;=&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#ff0000"&gt;'My project'&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt; @execs_package_name&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;=&lt;/font&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="color:;"&gt;&lt;font color="#ff0000"&gt;&lt;strong&gt;'Pkg.dtsx'&lt;/strong&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;pre style="list-style-type:disc;font-family:;background:white;color:;text-align:left;"&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;span style="color:;"&gt;&lt;font color="#008000"&gt;&lt;strong&gt;&lt;br /&gt;--Return information about the most recent execution&lt;/strong&gt;&lt;/font&gt;&lt;/span&gt;
&lt;strong&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;EXEC&lt;/font&gt;&lt;/span&gt; [dbo]&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;[sp_ssiscatalog]&lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;p&gt;One last thing, if sp_ssiscatalog is useful to you and you’d like to support future development feel free to donate to my personal beer fund at &lt;a href="http://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;amp;business=jamie@jamie-thomson.net&amp;amp;item_name=Supporting%20sp_ssiscatalog"&gt;http://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;amp;business=jamie@jamie-thomson.net&amp;amp;item_name=Supporting%20sp_ssiscatalog&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;
  &lt;hr /&gt;&lt;/p&gt;

&lt;h2&gt;Installation Instructions&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;Download the zip file at &lt;a href="http://ssisreportingpack.codeplex.com/releases/view/103261" target="_blank"&gt;DB v1.0.2.0&lt;/a&gt;. It contains two files, SsisReportingPack.dacpac &amp;amp; SSISDB.dacpac &lt;/li&gt;

  &lt;li&gt;Unzip to a folder of your choosing &lt;/li&gt;

  &lt;li&gt;Open a command prompt and change to the directory into which you unzipped the files &lt;/li&gt;

  &lt;li&gt;Execute: 
    &lt;ul&gt;
      &lt;li&gt;&amp;quot;%PROGRAMFILES(x86)%\Microsoft SQL Server\110\DAC\bin\sqlpackage.exe&amp;quot; /a:Publish /tdn:SsisReportingPack /sf:SSISReportingPack.dacpac /v:SSISDB=SSISDB /tsn:(local) 
        &lt;br /&gt;(/tsn specifies the target server, change as appropriate. /tdn specifies the database name, you can call it whatever you like.) &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If everything works OK you’ll see something like the following:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_7654045F.png"&gt;&lt;img title="image" style="border-left-width:0px;border-right-width:0px;background-image:none;border-bottom-width:0px;padding-top:0px;padding-left:0px;display:inline;padding-right:0px;border-top-width:0px;" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_41D33217.png" width="645" height="629" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This will (if it doesn’t already exist) create a database called [SsisReportingPack] (or whatever you chose to call it) which contains [dbo].[sp_ssiscatalog].&lt;/p&gt;

&lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_31E3ED53.png"&gt;&lt;img title="image" style="border-left-width:0px;border-right-width:0px;background-image:none;border-bottom-width:0px;padding-top:0px;padding-left:0px;display:inline;padding-right:0px;border-top-width:0px;" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_310B8769.png" width="353" height="397" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=48182" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/sp_5F00_ssiscatalog/default.aspx">sp_ssiscatalog</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/sql+server/default.aspx">sql server</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/sql+server+integration+services/default.aspx">sql server integration services</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/ssis/default.aspx">ssis</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/SSIS+Reporting+Pack/default.aspx">SSIS Reporting Pack</category></item><item><title>Deployment of client-specific database code using SSDT</title><link>http://sqlblog.com/blogs/jamie_thomson/archive/2013/03/10/deployment-of-client-specific-database-code-using-ssdt.aspx</link><pubDate>Sun, 10 Mar 2013 13:24:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:48159</guid><dc:creator>jamiet</dc:creator><slash:comments>6</slash:comments><comments>http://sqlblog.com/blogs/jamie_thomson/comments/48159.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/jamie_thomson/commentrss.aspx?PostID=48159</wfw:commentRss><wfw:comment>http://sqlblog.com/blogs/jamie_thomson/rsscomments.aspx?PostID=48159</wfw:comment><description>&lt;p&gt;Yesterday I attended &lt;a target="_blank" href="http://www.sqlsaturday.com/194/"&gt;SQL Saturday 194&lt;/a&gt; in Exeter for which many people deserve credit but especially the organisers &lt;a target="_blank" href="https://twitter.com/fatherjack"&gt;Jonathan Allen&lt;/a&gt; &amp;amp; &lt;a target="_blank" href="https://twitter.com/mrs_fatherjack"&gt;Annette Allen&lt;/a&gt; and the sponsors &lt;a target="_blank" href="http://www.fusionio.com/"&gt;Fusion-IO&lt;/a&gt;, &lt;a target="_blank" href="http://www.confio.com/"&gt;Confio Software&lt;/a&gt;, &lt;a target="_blank" href="http://www.nexusopensystems.co.uk/"&gt;Nexus&lt;/a&gt;, &lt;a target="_blank" href="http://www.bigbangdata.co.uk/Pages/default.aspx"&gt;Big Bang Data Company&lt;/a&gt;, &lt;a target="_blank" href="http://www.purplefrogsystems.com/"&gt;Purple Frog Systems&lt;/a&gt;, &lt;a target="_blank" href="http://www.red-gate.com/"&gt;Redgate&lt;/a&gt;, &lt;a target="_blank" href="http://www.idera.com/"&gt;idera&lt;/a&gt;, &lt;a target="_blank" href="http://pluralsight.com"&gt;Pluralsight&lt;/a&gt;, &lt;a target="_blank" href="http://exeterhotels.jurysinns.com/"&gt;Jurys Inn Exeter&lt;/a&gt; &amp;amp; &lt;a target="_blank" href="http://eu.wiley.com/"&gt;Wrox&lt;/a&gt;.&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2"&gt;     &lt;tr&gt;       &lt;td&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_072C63C9.png"&gt;&lt;img title="image" style="border-left-width:0px;border-right-width:0px;background-image:none;border-bottom-width:0px;padding-top:0px;padding-left:0px;display:inline;padding-right:0px;border-top-width:0px;" border="0" alt="image" width="327" height="238" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_312C61F1.png"&gt;&lt;/a&gt;&lt;/td&gt;        &lt;td&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_57221247.png"&gt;&lt;img title="image" style="border-left-width:0px;border-right-width:0px;background-image:none;border-bottom-width:0px;padding-top:0px;padding-left:0px;display:inline;padding-right:0px;border-top-width:0px;" border="0" alt="image" width="317" height="296" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_161392E3.png"&gt;&lt;/a&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/table&gt;  &lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;hr&gt;I gave a talk entitled &lt;b&gt;Declarative Database Development with SSDT&lt;/b&gt;; both during the session and then afterwards on Twitter &lt;a target="_blank" href="https://twitter.com/leopasta"&gt;Leo Pasta&lt;/a&gt; asked me&lt;p&gt;&amp;nbsp;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a target="_blank" href="https://twitter.com/leopasta/status/310680898049826816"&gt;&lt;img title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;display:inline;padding-right:0px;" border="0" alt="image" width="519" height="281" src="http://sqlblog.com/blogs/jamie_thomson/image_5505137E.png"&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;&lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;i&gt;&lt;a target="_blank" href="https://twitter.com/leopasta/status/310680898049826816"&gt;would you have any extra references on how to handle client-specific changes to the DB schema&lt;/a&gt;&lt;/i&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;I promised Leo an answer, hence this blog post.&lt;/p&gt;  &lt;p&gt;If I understand Leo’s question correctly he has an application that is used by multiple clients, he has a separate instance of the application for every client, and the database requires client-specific customisations; luckily for Leo there is a new feature in SSDT that is perfect for this situation. First let’s set up our solution in SSDT:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_45EE34A4.png"&gt;&lt;img title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;display:inline;padding-right:0px;" border="0" alt="image" width="359" height="284" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_52E814B5.png"&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;We have three database projects:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;_core - This contains all the objects that are common to all clients. For demonstration purposes it simply contains a table called [Sales]&lt;/li&gt;    &lt;li&gt;clientFoo – All the objects that are required only by client “Foo”. In this case there is view which aggregates the data in [Sales] by Customer&lt;/li&gt;    &lt;ul&gt;&lt;/ul&gt;    &lt;li&gt;clientBar – All the objects that are required only by client “Bar”. In this case there is view which aggregates the data in [Sales] by Location&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;In order that the reference to table [Sales] in the two views can be resolved both of the client-specific projects have a database reference to _core:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_38A7AB91.png"&gt;&lt;img title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;display:inline;padding-right:0px;" border="0" alt="image" width="242" height="244" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_09E1F2EF.png"&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;It is those database references that allows objects in clientFoo/clientBar to refer to objects in _core. Now here’s the important bit. When we set up those two database references &lt;b&gt;we must specify that the objects in the referenced project are intended to be in the same database&lt;/b&gt;:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/SNAGHTMLa9aab43_48D3738A.png"&gt;&lt;img title="SNAGHTMLa9aab43" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;display:inline;padding-right:0px;" border="0" alt="SNAGHTMLa9aab43" width="643" height="525" src="http://sqlblog.com/blogs/jamie_thomson/SNAGHTMLa9aab43_thumb_4722A7B6.png"&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Having objects from one database split over multiple projects is called &lt;b&gt;composite projects&lt;/b&gt;. The effect of this is that (by default) whenever clientFoo or clientBar are deployed &lt;b&gt;the objects in _core will get deployed as well&lt;/b&gt;. We can see this in the output when we deploy clientFoo:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_5ACF914A.png"&gt;&lt;img title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;display:inline;padding-right:0px;" border="0" alt="image" width="561" height="166" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_59F72B60.png"&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Notice how &lt;b&gt;even though we chose not to deploy _core&lt;/b&gt; two objects have been created; table [Sales] (from the _core project) and view [vSalesPerCustomer]. This is the new feature in SSDT that I spoke of above – a deployment of a project will (by default) also deploy all the objects in referenced projects where objects in the referenced database are intended to be in the same database (incidentally this functionality replaces the “partial projects” feature from previous incarnations of SSDT).&lt;/p&gt;  &lt;p&gt;Note that you can change this default behaviour in the advanced publish settings by unchecking the “Include composite objects” box:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/SNAGHTMLaac90d1_5CBCE053.png"&gt;&lt;img title="SNAGHTMLaac90d1" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;display:inline;padding-right:0px;" border="0" alt="SNAGHTMLaac90d1" width="422" height="612" src="http://sqlblog.com/blogs/jamie_thomson/SNAGHTMLaac90d1_thumb_61BF1E02.png"&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Hence, with the “Include Composite Objects” setting turned on, we can deploy both projects clientFoo &amp;amp; clientBar and both will contain table [Sales] plus their own client-specific view:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_2E16B1A4.png"&gt;&lt;img title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;display:inline;padding-right:0px;" border="0" alt="image" width="394" height="628" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_3F1ADF87.png"&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;which (I hope) is exactly what Leo was after!&lt;/p&gt;  &lt;p&gt;That’s all there is to it. A very very nice new feature of SSDT!&lt;/p&gt;  &lt;p&gt;&lt;a target="_blank" href="http://twitter.com/jamiet"&gt;@Jamiet&lt;/a&gt;&lt;/p&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=48159" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/sql+server/default.aspx">sql server</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/SQL+Server+Data+Tools/default.aspx">SQL Server Data Tools</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/SSDT/default.aspx">SSDT</category></item><item><title>New job, new computer, new software installs</title><link>http://sqlblog.com/blogs/jamie_thomson/archive/2013/03/07/new-job-new-computer-new-software-installs.aspx</link><pubDate>Thu, 07 Mar 2013 09:35:48 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:48090</guid><dc:creator>jamiet</dc:creator><slash:comments>23</slash:comments><comments>http://sqlblog.com/blogs/jamie_thomson/comments/48090.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/jamie_thomson/commentrss.aspx?PostID=48090</wfw:commentRss><wfw:comment>http://sqlblog.com/blogs/jamie_thomson/rsscomments.aspx?PostID=48090</wfw:comment><description>&lt;p&gt;Three days ago I started a new job and put a shout out on Twitter looking for suggestions as to what software bits-n-pieces I as a SQL Server developer should install.&lt;/p&gt;  &lt;p&gt;&lt;a href="https://twitter.com/jamiet/status/308849728026726400" target="_blank"&gt;&lt;img title="image" style="border-top:0px;border-right:0px;border-bottom:0px;border-left:0px;display:inline;" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_5C57D122.png" width="334" height="195" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I got some great replies (click &lt;a href="https://twitter.com/jamiet/status/308849728026726400" target="_blank"&gt;here&lt;/a&gt; to see them all) and here is the list of all “stuff” that I then installed (N.B. SQL Server and Visual Studio came pre-installed):&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.red-gate.com/products/sql-development/sql-prompt/" target="_blank"&gt;Redgate SQLPrompt&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://pragmaticworks.com/Products/DBA-xPress" target="_blank"&gt;Pragmatic Works DBA Express&lt;/a&gt; (in order to get &lt;a href="http://pragmaticworks.com/Products/DBA-xPress/Features/DataSurf.aspx" target="_blank"&gt;Data Surf&lt;/a&gt;)&lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.sqlsentry.net/plan-explorer/sql-server-query-view.asp" target="_blank"&gt;SQL Sentry Plan Explorer&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/data/tools.aspx" target="_blank"&gt;SQL Server Data Tools&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://bidshelper.codeplex.com/" target="_blank"&gt;BIDS Helper&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://notepad-plus-plus.org/" target="_blank"&gt;Notepad++&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.sublimetext.com/" target="_blank"&gt;Sublime Text&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.ssmstoolspack.com/" target="_blank"&gt;SSMS Tools Pack&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.microsoft.com/en-us/download/details.aspx?id=34595" target="_blank"&gt;Powershell 3.0&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://sqlpsx.codeplex.com/" target="_blank"&gt;SQLPSX&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.techsmith.com/snagit.html" target="_blank"&gt;SnagIt&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.stevemiller.net/puretext/" target="_blank"&gt;PureText&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://visualstudiogallery.msdn.microsoft.com/d0d33361-18e2-46c0-8ff2-4adea1e34fef" target="_blank"&gt;Visual Studio Productivity Power Tools&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.microsoft.com/en-gb/download/details.aspx?id=8621" target="_blank"&gt;Live Writer&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="https://apps.live.com/skydrive/app/9a65e47d-606a-4816-a246-90f54bf7a3ea" target="_blank"&gt;SkyDrive desktop app&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="https://www.google.com/intl/en/chrome/browser/" target="_blank"&gt;Chrome&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="https://www.yammer.com/company/desktop" target="_blank"&gt;Yammer Desktop App&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;A lot of those aren’t strictly speaking SQL Server related but, for me, they’re still invaluable.&lt;/p&gt;  &lt;p&gt;Do you have a similar list? Don’t be afraid to share ‘em and put a link below! And let me know if you think I’ve missed anything important.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://twitter.com/jamiet" target="_blank"&gt;@Jamiet&lt;/a&gt;&lt;/p&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=48090" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/sql+server/default.aspx">sql server</category></item><item><title>Weekend reading: Improvements to ODBC Data Source Adminstrator &amp; dacpac vs bacpacs</title><link>http://sqlblog.com/blogs/jamie_thomson/archive/2013/02/18/weekend-reading-improvements-to-odbc-data-source-adminstrator-dacpac-vs-bacpacs.aspx</link><pubDate>Mon, 18 Feb 2013 13:16:07 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:47781</guid><dc:creator>jamiet</dc:creator><slash:comments>2</slash:comments><comments>http://sqlblog.com/blogs/jamie_thomson/comments/47781.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/jamie_thomson/commentrss.aspx?PostID=47781</wfw:commentRss><wfw:comment>http://sqlblog.com/blogs/jamie_thomson/rsscomments.aspx?PostID=47781</wfw:comment><description>&lt;p&gt;I read a few articles over the weekend and learnt a few things that I think might be worth bringing to folks’ attention.&lt;/p&gt;  &lt;hr /&gt;  &lt;h3&gt;ODBC Administrator gets a lick of paint in Windows 8/Windows server 2012&lt;/h3&gt;  &lt;p&gt;The ODBC Administrator in Windows 8 has had some minor improvements. There’s now no longer a 32bit &amp;amp; a 64bit version of it, there’s only one and it has a new column to tell you whether the 32bit, 64bit drivers or both are installed. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_62B7A3D6.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_015E67F5.png" width="491" height="347" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;There are also a few PowerShell cmdlets to help with administration of ODBC Data Sources which if you’re a fan of automating deployments (as I am) is great news. Read more at &lt;a href="http://blogs.msdn.com/b/data/archive/2012/04/06/odbc-dsn-management-in-the-next-release-of-windows-code-named-windows-8-and-windows-server-8.aspx" target="_blank"&gt;ODBC DSN Management in the Next Release of Windows (code-named Windows “8” and Windows Server “8”)&lt;/a&gt;.&lt;/p&gt;  &lt;hr /&gt;  &lt;h3&gt;Bacpacs days may be numbered&lt;/h3&gt;  &lt;p&gt;Bacpacs are files that act as an easy portable backup of schema+data of a SQL Server database and are typically used to move data between an on-premise SQL Server instance &amp;amp; Windows Azure SQL Database (aka SQL Azure). Recently however Dacpacs gained the ability to deploy data also so I asked the question on the SSDT forum &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/ssdt/thread/fa31d617-db5b-465b-9577-8acd4763b874/" target="_blank"&gt;Given that a dacpac can now deploy data, why would I ever need bacpacs?&lt;/a&gt; Gert Drapers, who until recently ran the team that builds SSDT and the DAC Framework, replied with:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;BACPACs are a left over of the past more then anything.The main reason will be that most of the existing tooling, SSMS 2012, the Azure management portal and teh Azure Import Export service, only support BACPACs.       &lt;br /&gt;Right now the data support between the two is identical, DACPAC are or were supposed to add incremental data deployment, as right now it expects an empty table to load the data in to. &lt;strong&gt;Overtime I expect BACPAC to fade away and its usage to be replaced by DACPAC with data&lt;/strong&gt;.&lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;In other words the only reason right now to use dacpacs is that that is what the tooling supports however you should expect that to change in the future. Note that Gert is no longer on the team that builds those bits so don’t quote this as being a formal roadmap.&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;a href="http://twitter.com/jamiet" target="_blank"&gt;@Jamiet&lt;/a&gt;&lt;/p&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=47781" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/sql+server/default.aspx">sql server</category></item><item><title>Which version of SSDT Database Projects do I have installed?</title><link>http://sqlblog.com/blogs/jamie_thomson/archive/2013/02/08/which-version-of-ssdt-database-projects-do-i-have-installed.aspx</link><pubDate>Fri, 08 Feb 2013 21:15:52 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:47608</guid><dc:creator>jamiet</dc:creator><slash:comments>2</slash:comments><comments>http://sqlblog.com/blogs/jamie_thomson/comments/47608.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/jamie_thomson/commentrss.aspx?PostID=47608</wfw:commentRss><wfw:comment>http://sqlblog.com/blogs/jamie_thomson/rsscomments.aspx?PostID=47608</wfw:comment><description>&lt;p&gt;SQL Server Data Tools (SSDT) is released on a very regular cadence (note that I’m talking about the &lt;a href="http://sqlblog.com/blogs/jamie_thomson/archive/2012/04/03/ssdt-what-s-in-a-name.aspx" target="_blank"&gt;database projects part of SSDT&lt;/a&gt;, this is nothing to do with SSIS/SSAS/SSRS). Since the first release in &lt;a href="http://blogs.msdn.com/b/ssdt/archive/2012/03/05/available-today-sql-server-data-tools-rtw.aspx" target="_blank"&gt;March 2012&lt;/a&gt; there have been releases in &lt;a href="http://blogs.msdn.com/b/ssdt/archive/2012/09/14/now-available-sql-server-data-tools-september-2012-update.aspx" target="_blank"&gt;September 2012&lt;/a&gt;, &lt;a href="http://blogs.msdn.com/b/ssdt/archive/2012/11/07/sql-server-data-tools-november-2012-is-now-available.aspx" target="_blank"&gt;November 2012&lt;/a&gt;, &amp;amp; &lt;a href="http://blogs.msdn.com/b/ssdt/archive/2012/12/13/available-today-ssdt-december-2012.aspx" target="_blank"&gt;December 2012&lt;/a&gt;. I personally have found it difficult to keep track of not only which particular version I am using but also that which are my colleagues are using – quite simply I didn’t know how to discover the current version number. I assumed that the answer would lie within Visual Studio 2012 in the Help-&amp;gt;About Microsoft Visual Studio menu option, when I checked there I saw this:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/SNAGHTML339e96a2_1BDE30CA.png"&gt;&lt;img title="SNAGHTML339e96a2" style="border-left-width:0px;border-right-width:0px;background-image:none;border-bottom-width:0px;padding-top:0px;padding-left:0px;display:inline;padding-right:0px;border-top-width:0px;" border="0" alt="SNAGHTML339e96a2" src="http://sqlblog.com/blogs/jamie_thomson/SNAGHTML339e96a2_thumb_286BDDE6.png" width="507" height="333" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;A version number – 11.1.21208.0. What does that mean though? To understand more we have to go to Add/Remove programs:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/SNAGHTML42d8efe8_2008088F.png"&gt;&lt;img title="SNAGHTML42d8efe8" style="border-left-width:0px;border-right-width:0px;background-image:none;border-bottom-width:0px;padding-top:0px;padding-left:0px;display:inline;padding-right:0px;border-top-width:0px;" border="0" alt="SNAGHTML42d8efe8" src="http://sqlblog.com/blogs/jamie_thomson/SNAGHTML42d8efe8_thumb_528B6601.png" width="934" height="275" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;There are many different items listed there, let’s look at them in turn:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Microsoft SQL Server 2012 Data-Tier App Framework&lt;/strong&gt;. This is fairly self-explanatory if you know what the Data-Tier App Framework (aka DACFx) is. If you don’t, see the notes at the end of this blog post*. The reason that you see two entries in the list above is due to my having the 32bit &amp;amp; 64bit versions installed – the fact that there is no differentiation between the two in the title is a bug. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Microsoft SQL Server 2012 Express LocalDB&lt;/strong&gt;. LocalDB is the small server-less version of SQL Server that now gets deployed with SQL Server proper. LocalDB also gets installed with SSDT if you do not already have it, but you should consider it part of SQL Server itself. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Microsoft SQL Server Data Tools 2010&lt;/strong&gt;. This was described to me as the “installation chainer” – it is the installation component that manages SSDT and its dependencies. I think of it as the SSDT shell within Visual Studio 2010. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Microsoft SQL Server Data Tools 2012&lt;/strong&gt;. This was described to me as the “installation chainer” – it is the installation component that manages SSDT and its dependencies. I think of it as the SSDT shell within Visual Studio 2012. Note that the version number is the same as in the Help-&amp;gt;About screenshot at the top of this article – that is because they are one and the same. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Microsoft SQL Server Data Tools – Database Projects – Web installer entry point&lt;/strong&gt;. A stub project that gets installed when you install SQL Server. Its the SSDT database project entry point. &lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;&lt;u&gt;&lt;strong&gt;Microsoft SQL Server Data Tools – enu (10.3.21208.0)&lt;/strong&gt; &amp;amp; &lt;strong&gt;Microsoft SQL Server Data Tools – enu (11.1.21208.0)&lt;/strong&gt;. These are the things we’re interested in. These *are* SSDT database projects, for Visual Studio 2010 &amp;amp; Visual Studio 2012 respectively. The version numbers are those for the December 2012 release; note that the build numbers are the same (X.X.21208.X), only the major and minor numbers are different.&lt;/u&gt;&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Microsoft SQL Server Data Tools Build Utilities – enu (10.3.21208.0)&lt;/strong&gt; &amp;amp; &lt;strong&gt;Microsoft SQL Server Data Tools Build Utilities – enu (11.1.21208.0)&lt;/strong&gt;. Everything you need to do a headless (i.e. without having Visual Studio installed) build/deploy of an SSDT database project. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;So at the end of all that we have determined the following version numbers for SSDT database projects are:&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2"&gt;     &lt;tr&gt;       &lt;td&gt;         &lt;p align="center"&gt;&lt;strong&gt;Release&lt;/strong&gt;&lt;/p&gt;       &lt;/td&gt;        &lt;td&gt;&amp;nbsp;&lt;/td&gt;        &lt;td&gt;         &lt;p align="center"&gt;&lt;strong&gt;Visual Studio 2010 version number&lt;/strong&gt;&lt;/p&gt;       &lt;/td&gt;        &lt;td&gt;&amp;nbsp;&lt;/td&gt;        &lt;td&gt;         &lt;p align="center"&gt;&lt;strong&gt;Visual Studio 2012 version number&lt;/strong&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;         &lt;p align="center"&gt;September 2012&lt;/p&gt;       &lt;/td&gt;        &lt;td&gt;&amp;nbsp;&lt;/td&gt;        &lt;td&gt;         &lt;p align="center"&gt;10.3.20905.0&lt;/p&gt;       &lt;/td&gt;        &lt;td&gt;&amp;nbsp;&lt;/td&gt;        &lt;td&gt;         &lt;p align="center"&gt;11.1.20905.0&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;         &lt;p align="center"&gt;November 2012&lt;/p&gt;       &lt;/td&gt;        &lt;td&gt;&amp;nbsp;&lt;/td&gt;        &lt;td&gt;         &lt;p align="center"&gt;10.3.21101.1&lt;/p&gt;       &lt;/td&gt;        &lt;td&gt;&amp;nbsp;&lt;/td&gt;        &lt;td&gt;         &lt;p align="center"&gt;11.1.21101.1&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;         &lt;p align="center"&gt;December 2012&lt;/p&gt;       &lt;/td&gt;        &lt;td&gt;&amp;nbsp;&lt;/td&gt;        &lt;td&gt;         &lt;p align="center"&gt;10.3.21208.0&lt;/p&gt;       &lt;/td&gt;        &lt;td&gt;&amp;nbsp;&lt;/td&gt;        &lt;td&gt;         &lt;p align="center"&gt;11.1.21208.0&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/table&gt;  &lt;p&gt;&lt;strike&gt;I do not know the version numbers for the March 2012, September 2012 &amp;amp; November 2012 releases (if anyone out there does know please let me know in the comments) however I shall update this blog post for future releases.&lt;/strike&gt; September 2012 and November 2012 releases now added!&lt;/p&gt;  &lt;p&gt;I have requested that any blog post to announce future releases should contain the version numbers. Let’s hope that happens.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://twitter.com/jamiet" target="_blank"&gt;@Jamiet&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;* DACFx is described &lt;a href="http://www.microsoft.com/en-gb/download/details.aspx?id=35756" target="_blank"&gt;here&lt;/a&gt; as:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;The Microsoft® SQL Server® 2012 Data-Tier Application Framework (DACFx) is a component which provides application lifecycle services for database development and management for Microsoft® SQL Server® and Windows Azure SQL Databases.      &lt;br /&gt;DacFX supports various database deployment and management scenarios for SQL Server and Windows Azure SQL Databases including extracting/exporting a live database to a DAC package, deploying a DAC package to a new or existing database, and migrating from on-premise SQL Server to Windows Azure. This functionality is exposed via the DACFx managed API. DACFx can target SQL Server 2005 SP4, 2008 SP1, 2008R2, 2012, and Windows Azure SQL Databases. DACFx also provides the command-line utility SqlPackage.exe for creating and deploying .dacpac and .bacpac packages. DACFx supports scenarios provided by SQL Server client tooling including SQL Server Data Tools and SQL Server Management Studio 2012.&lt;/p&gt;&lt;/blockquote&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=47608" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/Datadude/default.aspx">Datadude</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/sql+server/default.aspx">sql server</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/SQL+Server+Data+Tools/default.aspx">SQL Server Data Tools</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/SSDT/default.aspx">SSDT</category></item><item><title>Obtaining rowcounts when using Composable DML [T-SQL]</title><link>http://sqlblog.com/blogs/jamie_thomson/archive/2013/02/07/obtaining-rowcounts-when-using-composable-dml.aspx</link><pubDate>Thu, 07 Feb 2013 13:59:57 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:47531</guid><dc:creator>jamiet</dc:creator><slash:comments>6</slash:comments><comments>http://sqlblog.com/blogs/jamie_thomson/comments/47531.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/jamie_thomson/commentrss.aspx?PostID=47531</wfw:commentRss><wfw:comment>http://sqlblog.com/blogs/jamie_thomson/rsscomments.aspx?PostID=47531</wfw:comment><description>&lt;p&gt;In my August 2009 blog post &lt;a href="http://sqlblog.com/blogs/jamie_thomson/archive/2009/08/31/exploring-composable-dml.aspx" target="_blank"&gt;Exploring Composable DML&lt;/a&gt; I introduced a new feature in SQL Server 2008 called Composable DML and also outlined one of its limitations; namely that data from the OUTPUT cannot be aggregated prior to insertion. Composable DML does have some useful scenarios however and one of those is in capturing and storing values that are replaced by an UPDATE (which I have talked about before in &lt;a title="http://sqlblog.com/blogs/jamie_thomson/archive/2012/07/13/using-composable-dml-to-maintain-entity-history-t-sql.aspx" href="http://sqlblog.com/blogs/jamie_thomson/archive/2012/07/13/using-composable-dml-to-maintain-entity-history-t-sql.aspx" target="_blank"&gt;Using Composable DML to maintain entity history&lt;/a&gt;). Here’s the basic premise:&lt;/p&gt;  &lt;blockquote&gt;   &lt;pre style="text-align:left;list-style-type:disc;font-family:;background:white;color:;"&gt;&lt;font face="Consolas"&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size:9.8pt;"&gt;INSERT&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:9.8pt;"&gt; old_values&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt; id&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt; name &lt;span style="color:;"&gt;&lt;font color="#808080"&gt;)&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#008000"&gt;--use Composable DML to store the values that were replaced by an UPDATE&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;SELECT&lt;/font&gt;&lt;/span&gt;	mrgout&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;deleted_id
&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;		mrgout&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;deleted_name
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;FROM	&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt;
		&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;MERGE&lt;/font&gt;&lt;/span&gt;	tgt
		&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;USING&lt;/font&gt;&lt;/span&gt;	src
			&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;ON&lt;/font&gt;&lt;/span&gt;	tgt&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;id &lt;span style="color:;"&gt;&lt;font color="#808080"&gt;=&lt;/font&gt;&lt;/span&gt; src&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;id
		&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;WHEN&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;MATCHED&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;THEN&lt;/font&gt;&lt;/span&gt;&amp;#160; &lt;span style="color:;"&gt;&lt;font color="#ff00ff"&gt;UPDATE&lt;/font&gt;&lt;/span&gt;	
			&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;SET&lt;/font&gt;&lt;/span&gt;	tgt&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;NAME &lt;span style="color:;"&gt;&lt;font color="#808080"&gt;=&lt;/font&gt;&lt;/span&gt; src&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;NAME&amp;#160;&amp;#160; &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;WHEN&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;NOT&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;MATCHED&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;THEN&lt;/font&gt;&lt;/span&gt;&amp;#160;&amp;#160; &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;INSERT&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt;id&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;name&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;)&lt;/font&gt;&lt;/span&gt;
			&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;VALUES&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt;src&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;id&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;src&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;name&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;)&lt;/font&gt;&lt;/span&gt;
		&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;OUTPUT&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#ff00ff"&gt;$ACTION&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;AS&lt;/font&gt;&lt;/span&gt; action_
		&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;		INSERTED&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;id &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;AS&lt;/font&gt;&lt;/span&gt; inserted_id
		&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;		INSERTED&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;NAME &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;AS&lt;/font&gt;&lt;/span&gt; inserted_name
		&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;		DELETED&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;id &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;AS&lt;/font&gt;&lt;/span&gt; deleted_id
		&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;		DELETED&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;name &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;AS&lt;/font&gt;&lt;/span&gt; deleted_name
		&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;)&lt;/font&gt;&lt;/span&gt;mrgout
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;WHERE&lt;/font&gt;&lt;/span&gt;	mrgout&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;action_ &lt;span style="color:;"&gt;&lt;font color="#808080"&gt;=&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#ff0000"&gt;'UPDATE'&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#008000"&gt;--Filtering on $action=UPDATE allows us to get the replaced values from DELETED virtual table&lt;/font&gt;&lt;/span&gt;
&lt;/font&gt;&lt;span style="color:;"&gt;&lt;font style="font-size:9.8pt;" color="#808080"&gt;;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;This statement updates some rows in [tgt] and stores the old values in [old_values]. I think that’s rather useful, especially in a data warehousing scenario where one may wish to MERGE to a type 1 dimension table. Unfortunately this scenario gives rise to another limitation of Composable DML – the value returned by &lt;font color="#ff00ff"&gt;@@ROWCOUNT&lt;/font&gt; is the number of rows that were affected in [old_values], not in [tgt]. The following code (which you can simply copy/paste and execute and which is also &lt;a href="http://pastebin.com/5wBsTVx9" target="_blank"&gt;available on pastebin&lt;/a&gt;) demonstrates this problem:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre style="text-align:left;list-style-type:disc;font-family:;background:white;color:;"&gt;&lt;font face="Consolas"&gt;&lt;span style="color:;"&gt;&lt;font color="#008000"&gt;&lt;font style="font-size:9.8pt;"&gt;/******************************************************************************************************************************&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:9.8pt;"&gt;
&lt;span style="color:;"&gt;&lt;font color="#008000"&gt;A demonstration of capturing rowcounts when using composable DML. The problem I'm trying to demonstrate here is that &lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#008000"&gt;I don't think there is a way to capture the number of rows affected by the MERGE&lt;/font&gt;&lt;/span&gt;
 
&lt;span style="color:;"&gt;&lt;font color="#008000"&gt;Jamie Thomson, 2013-02-07&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#008000"&gt;******************************************************************************************************************************/&lt;/font&gt;&lt;/span&gt;
 
&lt;span style="color:;"&gt;&lt;font color="#008000"&gt;/*Setup table first and insert some data into [src]*/&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;USE&lt;/font&gt;&lt;/span&gt; tempdb
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;IF&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#ff00ff"&gt;OBJECT_ID&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#ff0000"&gt;'src'&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;)&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;IS&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;NOT&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;NULL&lt;/font&gt;&lt;/span&gt;		&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;DROP&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;TABLE&lt;/font&gt;&lt;/span&gt; src&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;;&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;CREATE&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;TABLE&lt;/font&gt;&lt;/span&gt; src&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;#160;&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt;
	id		&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;INT&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;	name&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;NVARCHAR&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#ff00ff"&gt;MAX&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;)&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;);&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;IF&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#ff00ff"&gt;OBJECT_ID&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#ff0000"&gt;'tgt'&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;)&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;IS&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;NOT&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;NULL&lt;/font&gt;&lt;/span&gt;		&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;DROP&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;TABLE&lt;/font&gt;&lt;/span&gt; tgt&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;;&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;CREATE&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;TABLE&lt;/font&gt;&lt;/span&gt; tgt&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;#160;&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt;
	id		&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;INT&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;	name&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;NVARCHAR&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#ff00ff"&gt;MAX&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;)&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;);&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#008000"&gt;/*[updates] will be used as the target of the Composable DML insertion*/&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;IF&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#ff00ff"&gt;OBJECT_ID&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#ff0000"&gt;'old_values'&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;)&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;IS&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;NOT&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;NULL&lt;/font&gt;&lt;/span&gt;		&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;DROP&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;TABLE&lt;/font&gt;&lt;/span&gt; old_values&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;;&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;CREATE&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;TABLE&lt;/font&gt;&lt;/span&gt; old_values&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;#160;&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt;
	id		&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;INT&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;	name&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;NVARCHAR&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#ff00ff"&gt;MAX&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;)&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;);&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;INSERT&lt;/font&gt;&lt;/span&gt; src&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt;id&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;name&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;)&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;VALUES&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt;1&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#ff0000"&gt;'don'&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;),(&lt;/font&gt;&lt;/span&gt;2&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#ff0000"&gt;'kaina'&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;);&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;GO&lt;/font&gt;&lt;/span&gt;
 
&lt;span style="color:;"&gt;&lt;font color="#008000"&gt;/*Everything after here gets run twice because the batch ends with GO 2*/&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;INSERT&lt;/font&gt;&lt;/span&gt; old_values&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt; id&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt; name &lt;span style="color:;"&gt;&lt;font color="#808080"&gt;)&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#008000"&gt;--use Composable DML to store the values that were replaced by an UPDATE&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;SELECT&lt;/font&gt;&lt;/span&gt;	mrgout&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;deleted_id
&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;		mrgout&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;deleted_name
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;FROM	&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt;
		&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;MERGE&lt;/font&gt;&lt;/span&gt;	tgt
		&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;USING&lt;/font&gt;&lt;/span&gt;	src
			&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;ON&lt;/font&gt;&lt;/span&gt;	tgt&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;id &lt;span style="color:;"&gt;&lt;font color="#808080"&gt;=&lt;/font&gt;&lt;/span&gt; src&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;id
		&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;WHEN&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;MATCHED&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;THEN&lt;/font&gt;&lt;/span&gt;&amp;#160; &lt;span style="color:;"&gt;&lt;font color="#ff00ff"&gt;UPDATE&lt;/font&gt;&lt;/span&gt;	
			&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;SET&lt;/font&gt;&lt;/span&gt;	tgt&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;NAME &lt;span style="color:;"&gt;&lt;font color="#808080"&gt;=&lt;/font&gt;&lt;/span&gt; src&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;NAME&amp;#160;&amp;#160; &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;WHEN&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;NOT&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;MATCHED&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;THEN&lt;/font&gt;&lt;/span&gt;&amp;#160;&amp;#160; &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;INSERT&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt;id&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;name&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;)&lt;/font&gt;&lt;/span&gt;
			&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;VALUES&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt;src&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;id&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;src&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;name&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;)&lt;/font&gt;&lt;/span&gt;
		&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;OUTPUT&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#ff00ff"&gt;$ACTION&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;AS&lt;/font&gt;&lt;/span&gt; action_
		&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;		INSERTED&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;id &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;AS&lt;/font&gt;&lt;/span&gt; inserted_id
		&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;		INSERTED&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;NAME &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;AS&lt;/font&gt;&lt;/span&gt; inserted_name
		&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;		DELETED&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;id &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;AS&lt;/font&gt;&lt;/span&gt; deleted_id
		&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;		DELETED&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;name &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;AS&lt;/font&gt;&lt;/span&gt; deleted_name
		&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;)&lt;/font&gt;&lt;/span&gt;mrgout
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;WHERE&lt;/font&gt;&lt;/span&gt;	mrgout&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;action_ &lt;span style="color:;"&gt;&lt;font color="#808080"&gt;=&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#ff0000"&gt;'UPDATE'&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#008000"&gt;--Filtering on $action=UPDATE allows us to get the replaced values from DELETED virtual table&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;;&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;SELECT&lt;/font&gt;&lt;/span&gt;	[@@ROWCOUNT]&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;=&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#ff00ff"&gt;@@ROWCOUNT&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;row_tally_in_tgt&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;=(&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;SELECT&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#ff00ff"&gt;COUNT&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(*)&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;FROM&lt;/font&gt;&lt;/span&gt; tgt&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;)&lt;/font&gt;&lt;/span&gt;&amp;#160; &lt;span style="color:;"&gt;&lt;font color="#008000"&gt;-- &amp;lt;-Rowcount only provides tally of rows affected by the outer INSERT, not the MERGE&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;GO&lt;/font&gt;&lt;/span&gt; 2
&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here is the output:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_7001D9F8.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_1A01D821.png" width="244" height="137" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Notice that the Composable DML containing the MERGE statement is executed twice. The first execution inserts two rows into [tgt] yet &lt;span style="color:;"&gt;&lt;font color="#ff00ff"&gt;@@ROWCOUNT&lt;/font&gt;&lt;/span&gt; returns zero because zero rows were inserted into [old_values] by the outer query. The second execution results in two rows in [tgt] being updated hence two rows are inserted into [old_values] and hence why &lt;span style="color:;"&gt;&lt;font color="#ff00ff"&gt;@@ROWCOUNT&lt;/font&gt;&lt;/span&gt; returns two. It appears there is no way to discover the number of inserts or updates that were committed by the MERGE; if you’re a fan of logging rowcounts during ETL operations (which I think you should be) then this is a big problem. The only way I can think of getting around this problem is to break the statement into two like so (for brevity I haven’t included the full code listing so it is also available &lt;a href="http://pastebin.com/HHSSNV2H" target="_blank"&gt;on pastebin&lt;/a&gt;):&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre style="text-align:left;list-style-type:disc;font-family:;background:white;color:;"&gt;&lt;font face="Consolas"&gt;&lt;span style="color:;"&gt;&lt;font color="#008000"&gt;&lt;font style="font-size:9.8pt;"&gt;/*Setup part is the same as before, we do need an extra table for capturing the output of our MERGE tho*/&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:9.8pt;"&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;IF&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#ff00ff"&gt;OBJECT_ID&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#ff0000"&gt;'mrgout'&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;)&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;IS&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;NOT&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;NULL&lt;/font&gt;&lt;/span&gt;		&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;DROP&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;TABLE&lt;/font&gt;&lt;/span&gt; mrgout&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;;&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;CREATE&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;TABLE&lt;/font&gt;&lt;/span&gt; mrgout&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;#160;&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt;
	action_			&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;NVARCHAR&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#ff00ff"&gt;MAX&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;)&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;	inserted_id		&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;INT&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;	inserted_name&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;NVARCHAR&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#ff00ff"&gt;MAX&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;)&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;	deleted_id		&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;INT&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;	deleted_name&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;NVARCHAR&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#ff00ff"&gt;MAX&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;)&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;);&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;INSERT&lt;/font&gt;&lt;/span&gt; src&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt;id&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;name&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;)&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;VALUES&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt;1&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#ff0000"&gt;'don'&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;),(&lt;/font&gt;&lt;/span&gt;2&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#ff0000"&gt;'kaina'&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;);&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;GO&lt;/font&gt;&lt;/span&gt;
 
&lt;span style="color:;"&gt;&lt;font color="#008000"&gt;/*Everything after here gets run twice because the batch ends with GO 2*/&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;TRUNCATE&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;TABLE&lt;/font&gt;&lt;/span&gt; mrgout&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;;&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;INSERT&lt;/font&gt;&lt;/span&gt; mrgout&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt;action_&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt; inserted_id&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt; inserted_name&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;deleted_id&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt; deleted_name &lt;span style="color:;"&gt;&lt;font color="#808080"&gt;)&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;SELECT&lt;/font&gt;&lt;/span&gt;	mrgout&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;action_
&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;		mrgout&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;inserted_id
&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;		mrgout&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;inserted_name
&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;		mrgout&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;deleted_id
&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;		mrgout&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;deleted_name
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;FROM	&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt;
		&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;MERGE&lt;/font&gt;&lt;/span&gt;	tgt
		&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;USING&lt;/font&gt;&lt;/span&gt;	src
			&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;ON&lt;/font&gt;&lt;/span&gt;	tgt&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;id &lt;span style="color:;"&gt;&lt;font color="#808080"&gt;=&lt;/font&gt;&lt;/span&gt; src&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;id
		&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;WHEN&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;MATCHED&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;THEN&lt;/font&gt;&lt;/span&gt;&amp;#160; &lt;span style="color:;"&gt;&lt;font color="#ff00ff"&gt;UPDATE&lt;/font&gt;&lt;/span&gt;	
			&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;SET&lt;/font&gt;&lt;/span&gt;	tgt&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;NAME &lt;span style="color:;"&gt;&lt;font color="#808080"&gt;=&lt;/font&gt;&lt;/span&gt; src&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;NAME&amp;#160;&amp;#160; &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;WHEN&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;NOT&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;MATCHED&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;THEN&lt;/font&gt;&lt;/span&gt;&amp;#160;&amp;#160; &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;INSERT&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt;id&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;name&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;)&lt;/font&gt;&lt;/span&gt;
			&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;VALUES&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt;src&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;id&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;src&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;name&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;)&lt;/font&gt;&lt;/span&gt;
		&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;OUTPUT&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#ff00ff"&gt;$ACTION&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;AS&lt;/font&gt;&lt;/span&gt; action_
		&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;		INSERTED&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;id &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;AS&lt;/font&gt;&lt;/span&gt; inserted_id
		&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;		INSERTED&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;NAME &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;AS&lt;/font&gt;&lt;/span&gt; inserted_name
		&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;		DELETED&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;id &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;AS&lt;/font&gt;&lt;/span&gt; deleted_id
		&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;		DELETED&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;name &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;AS&lt;/font&gt;&lt;/span&gt; deleted_name
		&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;)&lt;/font&gt;&lt;/span&gt;mrgout
&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;;&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;INSERT&lt;/font&gt;&lt;/span&gt;	dbo&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;old_values&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;/span&gt;id&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;name&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;)&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;SELECT&lt;/font&gt;&lt;/span&gt;	deleted_id&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;deleted_name &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;FROM&lt;/font&gt;&lt;/span&gt; mrgout
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;WHERE&lt;/font&gt;&lt;/span&gt;	mrgout&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;action_ &lt;span style="color:;"&gt;&lt;font color="#808080"&gt;=&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#ff0000"&gt;'UPDATE'&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#008000"&gt;--Filtering on $action=UPDATE allows us to get the replaced values from DELETED virtual table&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;SELECT&lt;/font&gt;&lt;/span&gt;	[INSERT_@@ROWCOUNT]&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;=(&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;SELECT&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#ff00ff"&gt;COUNT&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(*)&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;FROM&lt;/font&gt;&lt;/span&gt; mrgout &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;WHERE&lt;/font&gt;&lt;/span&gt; action_ &lt;span style="color:;"&gt;&lt;font color="#808080"&gt;=&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#ff0000"&gt;'INSERT'&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;),&lt;/font&gt;&lt;/span&gt;[UPDATE_@@ROWCOUNT]&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;=(&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;SELECT&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#ff00ff"&gt;COUNT&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(*)&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;FROM&lt;/font&gt;&lt;/span&gt; mrgout &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;WHERE&lt;/font&gt;&lt;/span&gt; action_ &lt;span style="color:;"&gt;&lt;font color="#808080"&gt;=&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#ff0000"&gt;'UPDATE'&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;),&lt;/font&gt;&lt;/span&gt;row_tally_in_tgt&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;=(&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;SELECT&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#ff00ff"&gt;COUNT&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;(*)&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;FROM&lt;/font&gt;&lt;/span&gt; tgt&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;)&lt;/font&gt;&lt;/span&gt;&amp;#160;&amp;#160; &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;GO&lt;/font&gt;&lt;/span&gt; 2
&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;Executing that returns:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_1FDC7BBA.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_13DA8B86.png" width="459" height="171" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is much better. We now know the tally of insertions and updates committed by the MERGE, unfortunately we have had to do it in two separate statements which in a way defeats the point of using MERGE in the first place (and don’t forget some of the other &lt;a href="http://www.sqlperformance.com/2013/02/t-sql-queries/another-merge-bug" target="_blank"&gt;current problems with MERGE&lt;/a&gt;). If you can think of a better way of doing it then I’m all ears – please reply in the &lt;a href="http://sqlblog.com/blogs/jamie_thomson/archive/2013/02/07/obtaining-rowcounts-when-using-composable-dml.aspx#comments" target="_blank"&gt;comments&lt;/a&gt; below.&lt;/p&gt;

&lt;p&gt;I’m not saying don’t use MERGE and I’m not saying don’t use Composable DML; just be aware of their limitations. Personally I think there should be built-in functions, similar to &lt;span style="color:;"&gt;&lt;font color="#ff00ff"&gt;@@ROWCOUNT&lt;/font&gt;&lt;/span&gt;, that return the number of rows INSERTed/DELETEd/UPDATEd by a MERGE; &lt;a href="http://sqlblog.com/blogs/aaron_bertrand/" target="_blank"&gt;Aaron Bertrand&lt;/a&gt; agreed and raised a Connect submission to that affect: &lt;a title="https://connect.microsoft.com/SQLServer/feedback/details/298395/katmai-merge-does-not-distinguish-rowcounts-in-triggers" href="https://connect.microsoft.com/SQLServer/feedback/details/298395/katmai-merge-does-not-distinguish-rowcounts-in-triggers" target="_blank"&gt;Katmai : Merge does not distinguish rowcounts in triggers&lt;/a&gt; which has, unfortunately, “been closed as won’t fix”.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://twitter.com/jamiet" target="_blank"&gt;@Jamiet&lt;/a&gt;&lt;/p&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=47531" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/Composable+DML/default.aspx">Composable DML</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/merge/default.aspx">merge</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/sql+server/default.aspx">sql server</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/t-sql/default.aspx">t-sql</category></item><item><title>NOEXPAND query hint returns wrong results – CU fix now available</title><link>http://sqlblog.com/blogs/jamie_thomson/archive/2013/02/04/noexpand-query-hint-returns-wrong-results-cu-fix-now-available.aspx</link><pubDate>Mon, 04 Feb 2013 10:24:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:47466</guid><dc:creator>jamiet</dc:creator><slash:comments>0</slash:comments><comments>http://sqlblog.com/blogs/jamie_thomson/comments/47466.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/jamie_thomson/commentrss.aspx?PostID=47466</wfw:commentRss><wfw:comment>http://sqlblog.com/blogs/jamie_thomson/rsscomments.aspx?PostID=47466</wfw:comment><description>&lt;p&gt;Three days ago at my current gig we stumbled across a problem where use of the &lt;a href="http://msdn.microsoft.com/en-gb/library/ms181714.aspx" target="_blank"&gt;NOEXPAND query hint&lt;/a&gt; was causing different results compared to the same query &lt;em&gt;without&lt;/em&gt; NOEXPAND. For those that do not know (which, until three days ago, included me) NOEXPAND governs the use of indexed views:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;The indexed view is not expanded only if the view is directly referenced in the SELECT part of the query and WITH (NOEXPAND) or WITH (NOEXPAND, INDEX(index_value [ &lt;strong&gt;,&lt;/strong&gt;...n ] ) ) is specified.        &lt;br&gt;&lt;/em&gt;&lt;a title="http://msdn.microsoft.com/en-gb/library/ms181714.aspx" href="http://msdn.microsoft.com/en-gb/library/ms181714.aspx"&gt;&lt;em&gt;http://msdn.microsoft.com/en-gb/library/ms181714.aspx&lt;/em&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;This screenshot demonstrates the problem:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_09EE107F.png"&gt;&lt;img style="border:0px currentColor;padding-top:0px;padding-right:0px;padding-left:0px;display:inline;background-image:none;" title="image" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_5645A420.png" width="936" height="225"&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Clearly this isn’t good. &lt;a href="https://twitter.com/jamiet/status/297384398972657664" target="_blank"&gt;I put a comment out on Twitter&lt;/a&gt; hoping someone knew something about it and thankfully &lt;a href="https://twitter.com/gonsalu"&gt;Gonçalo Ferreira&lt;/a&gt; was reading. He &lt;a href="https://twitter.com/gonsalu/status/298140026796138496" target="_blank"&gt;pointed me&lt;/a&gt; toward a Knowledge Base article entitled &lt;a href="http://support.microsoft.com/kb/2756471" target="_blank"&gt;FIX: Incorrect result is returned when you query an indexed view by using the NOEXPAND hint in SQL Server 2008, in SQL Server 2008 R2 or in SQL Server 2012&lt;/a&gt; that confirmed this as being a bug in SQL Server. The article is dated 24th January 2013 (that is only 11 days ago folks) and describes the bug rearing its head under these circumstances:&lt;/p&gt;  &lt;blockquote&gt;   &lt;ul&gt;     &lt;li&gt;&lt;font color="#c0504d"&gt;You create an indexed view for two tables that have a foreign key reference in Microsoft SQL Server 2008, in Microsoft SQL Server 2012 or in Microsoft SQL Server 2008 R2. &lt;/font&gt;&lt;/li&gt;      &lt;li&gt;&lt;font color="#c0504d"&gt;You update the base tables of the indexed view. &lt;/font&gt;&lt;/li&gt;      &lt;li&gt;&lt;font color="#c0504d"&gt;You run a query against the indexed view that uses the NOEXPAND hint.&lt;/font&gt;&lt;/li&gt;   &lt;/ul&gt;   &lt;font color="#c0504d"&gt;In this scenario, you receive an incorrect result.&lt;/font&gt;&lt;/blockquote&gt;  &lt;p&gt;I don’t know about you but I read that as “If you’re using Indexed Views with NOEXPAND, they’re most likely giving you the wrong answer”. The latest cumulative update (CU) for:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;SQL Server 2012&lt;/li&gt;    &lt;li&gt;SQL Server 2012 SP1&lt;/li&gt;    &lt;li&gt;SQL Server 2008 R2 SP2&lt;/li&gt;    &lt;li&gt;SQL Server 2008 R2 SP1&lt;/li&gt;    &lt;li&gt;SQL Server 2008 SP3&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;fixes the problem. If you’re using indexed views you may want to install the CU, sharpish!&lt;/p&gt;  &lt;p&gt;&lt;a href="http://twitter.com/jamiet" target="_blank"&gt;@Jamiet&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="text-transform:none;text-indent:0px;letter-spacing:normal;word-spacing:0px;float:none;white-space:normal;orphans:2;widows:2;font-size-adjust:none;font-stretch:normal;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;"&gt;UPDATE. Paul White has posted a fantastic blog post where he explains how to reproduce the problem: &lt;a href="http://sqlblog.com/blogs/paul_white/archive/2013/02/06/incorrect-results-with-indexed-views.aspx" target="_blank"&gt;Incorrect Results with Indexed Views&lt;/a&gt;&amp;nbsp;(N.B. It occurs if you are using the MERGE statement) and Aaron Bertrand has followed with&amp;nbsp;the equally readable &lt;a href="http://www.sqlperformance.com/2013/02/t-sql-queries/another-merge-bug" target="_blank"&gt;If you are using indexed views and MERGE, please read this!&lt;/a&gt; where he offers some considered opinions and advice surrounding the issue. I highly recommend reading both.&lt;/span&gt;&lt;/p&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=47466" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/Indexed+Views/default.aspx">Indexed Views</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/NOEXPAND/default.aspx">NOEXPAND</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/sql+server/default.aspx">sql server</category></item><item><title>Responses to SSDT questions</title><link>http://sqlblog.com/blogs/jamie_thomson/archive/2013/01/11/responses-to-ssdt-questions.aspx</link><pubDate>Fri, 11 Jan 2013 22:22:24 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:47124</guid><dc:creator>jamiet</dc:creator><slash:comments>1</slash:comments><comments>http://sqlblog.com/blogs/jamie_thomson/comments/47124.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/jamie_thomson/commentrss.aspx?PostID=47124</wfw:commentRss><wfw:comment>http://sqlblog.com/blogs/jamie_thomson/rsscomments.aspx?PostID=47124</wfw:comment><description>&lt;p&gt;My recent article &lt;a href="http://www.devproconnections.com/article/sql-server-2012/sql-server-2012-data-tools-144829"&gt;Get to Know SQL Server 2012's SQL Server Data Tools&lt;/a&gt; prompted two questions to come to me via email and in the interests of sharing knowledge via search engines I thought I would answer them here rather than by simply replying by email (I hate that so much useful information gets trapped inside closed inboxes).&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;em&gt;&lt;font color="#c0504d"&gt;Question: How would you handle cases below, our main database has many objects already, we are using redgate source control to keep things under sourcecontrol but ssdt would be awesome.        &lt;br /&gt;Our database has some invalid stored procs etc, unfortunately we do not want to drop them, underlying objects either don't exists or has changed etc         &lt;br /&gt;There are linked servers or code referencing other objects stored in the database         &lt;br /&gt;There are staging table named automatically in the database and we do not want to include them in the project and not drop them or touch them in a deploy &lt;/font&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;JT: The overall question here seems to be “how do we prevent SSDT from DROPping sprocs and staging tables that are in the target database but are not in the SSDT project?” Fortunately SSDT has an option within it to allow exactly what the questioner requires. When an SSDT project is published one has the option to set some properties relating to that publish. One of the settings is “DROP objects in target but not in project”:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/SNAGHTML5751f10_20688721.png"&gt;&lt;img title="SNAGHTML5751f10" style="border-left-width:0px;border-right-width:0px;background-image:none;border-bottom-width:0px;padding-top:0px;padding-left:0px;display:inline;padding-right:0px;border-top-width:0px;" border="0" alt="SNAGHTML5751f10" src="http://sqlblog.com/blogs/jamie_thomson/SNAGHTML5751f10_thumb_11A9A170.png" width="340" height="484" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;If that option is left unchecked (which is the default) then no objects will get removed from the target database.&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;em&gt;&lt;font color="#c0504d"&gt;Question: At my previous shop, I done a proof of concept with one of our databases, but never got it implemented as VS2012 (with SSDT) had not been released yet. Well, fast forward 9 or so months, and at my new shop (which is extremely agile) I've been tasked with setting up our db projects with SSDT so for the immediate short term goals/objectives we can;&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;em&gt;&lt;font color="#c0504d"&gt;Allow new or existing developers to be able to easily get the latest databases from source control downloaded from TFS, built and deployed onto our local sandbox db environments. This ideally will be done via a powershell script or something of the sort. &lt;/font&gt;&lt;/em&gt;&lt;/li&gt;    &lt;li&gt;&lt;font color="#c0504d"&gt;&lt;em&gt;Be able to employ C.I. so that every night a database deployment is done to our system test servers.&lt;/em&gt; &lt;/font&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;em&gt;&lt;font color="#c0504d"&gt;3 days into it, and I've wrestled with 3 of our databases, reverse engineering them into TFS and getting them built etc. My question is, what are the best practices or guidelines for;&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;em&gt;&lt;font color="#c0504d"&gt;Allowing only Windows authentication for the local deploys to the sandbox environment. i.e. is it best to have a script with all our team user logins in a script? How would the project recognise a team member which will create a login for them so once the project is deployed they can login to their local db? &lt;/font&gt;&lt;/em&gt;&lt;/li&gt;    &lt;li&gt;&lt;em&gt;&lt;font color="#c0504d"&gt;Using a 1-touch/click action (preferably outside of VS2010) to get latest, build project &amp;amp; deploy to local sandbox &lt;/font&gt;&lt;/em&gt;&lt;/li&gt;    &lt;li&gt;&lt;em&gt;&lt;font color="#c0504d"&gt;Same as above but to a system test server&lt;/font&gt;&lt;/em&gt; &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;JT: There are quite a few questions there. Firstly I’ll say that its great to hear of sandboxed environments and Continuous Integration (CI) being used – I openly advocate these techniques in my blog post &lt;a href="http://sqlblog.com/blogs/jamie_thomson/archive/2012/01/01/implementing-sql-server-solutions-using-visual-studio-2010-database-projects-a-compendium-of-project-experiences.aspx"&gt;Implementing SQL Server solutions using Visual Studio 2010 Database Projects – a compendium of project experiences&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Now, taking each question in turn:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Windows Auth for local deploys. I’m not sure if there’s any recognised best practise here but if developers are working on local sandboxes I would assume they would have sysadmin rights so I’m not sure there’s a need to have a script of team logins. Perhaps I have misunderstood the question in which case please clarify in the comments below. I will say this though – I think its better to have a Windows group that you can move all of your devs in and out of rather than having to modify a script each time a user joins your team. &lt;/li&gt;    &lt;li&gt;1-click get latest, build &amp;amp; deploy. Scripting your build &amp;amp; deploy is something else I advocate in the &lt;a href="http://sqlblog.com/blogs/jamie_thomson/archive/2012/01/01/implementing-sql-server-solutions-using-visual-studio-2010-database-projects-a-compendium-of-project-experiences.aspx"&gt;aforementioned blog post&lt;/a&gt;:       &lt;blockquote&gt;       &lt;p&gt;&lt;em&gt;Building and deploying your datadude projects within Visual Studio can become a real time hog; in my experience its not unusual for deployments to take many minutes and your Visual Studio environment will be unavailable for further development work during that time. For that reason I recommend investing some time in writing some msbuild scripts that will build and deploy your project(s) from the command-line.&lt;/em&gt;&lt;/p&gt;     &lt;/blockquote&gt;      &lt;p&gt;I’ll go further here and say that the script with which you use to build and deploy to your sandbox should be the same script as which you use for your production environment and everything in between. The script should take a parameter value to name the environment and then deploy appropriately.&lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;See 2. &lt;/li&gt; &lt;/ol&gt;    &lt;hr /&gt;Hope that is useful. Any questions? Please put them in the comments.    &lt;p&gt;&lt;a href="http://twitter.com/jamiet" target="_blank"&gt;@Jamiet&lt;/a&gt;&lt;/p&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=47124" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/Datadude/default.aspx">Datadude</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/sql+server/default.aspx">sql server</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/SQL+Server+Data+Tools/default.aspx">SQL Server Data Tools</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/SSDT/default.aspx">SSDT</category></item><item><title>Get to Know SQL Server 2012's SQL Server Data Tools [article published]</title><link>http://sqlblog.com/blogs/jamie_thomson/archive/2013/01/10/get-to-know-sql-server-2012-s-sql-server-data-tools-article-published.aspx</link><pubDate>Wed, 09 Jan 2013 23:12:03 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:47093</guid><dc:creator>jamiet</dc:creator><slash:comments>2</slash:comments><comments>http://sqlblog.com/blogs/jamie_thomson/comments/47093.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/jamie_thomson/commentrss.aspx?PostID=47093</wfw:commentRss><wfw:comment>http://sqlblog.com/blogs/jamie_thomson/rsscomments.aspx?PostID=47093</wfw:comment><description>&lt;p&gt;I recently wrote an article on SQL Server Data Tools for SQL Server Magazine and it has now been published online at &lt;a href="http://www.devproconnections.com/article/sql-server-2012/sql-server-2012-data-tools-144829" target="_blank"&gt;Get to Know SQL Server 2012's SQL Server Data Tools&lt;/a&gt;. In the article I offer my thoughts and opinions on SQL Server Data Tools as it exists in SQL Server 2012.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://www.devproconnections.com/article/sql-server-2012/sql-server-2012-data-tools-144829"&gt;&lt;img title="image" style="border-top:0px;border-right:0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;display:inline;padding-right:0px;" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_54C3565A.png" width="558" height="231" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Note that the article refers to SSDT database projects only, there is nothing in there pertaining to SSIS, SSAS or SSRS. If you find that confusing then you should probably go and at least read the first few paragraphs of the article where I try to alleviate some of that confusion.&lt;/p&gt;  &lt;p&gt;Constructive feedback is, as always, very welcome.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://twitter.com/jamiet" target="_blank"&gt;@Jamiet&lt;/a&gt;&lt;/p&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=47093" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/sql+server/default.aspx">sql server</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/SQL+Server+Data+Tools/default.aspx">SQL Server Data Tools</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/SSDT/default.aspx">SSDT</category></item><item><title>“Add as object” or “Add as script”? [SSDT]</title><link>http://sqlblog.com/blogs/jamie_thomson/archive/2013/01/04/add-as-object-or-add-as-script-ssdt.aspx</link><pubDate>Fri, 04 Jan 2013 14:15:46 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:47006</guid><dc:creator>jamiet</dc:creator><slash:comments>4</slash:comments><comments>http://sqlblog.com/blogs/jamie_thomson/comments/47006.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/jamie_thomson/commentrss.aspx?PostID=47006</wfw:commentRss><wfw:comment>http://sqlblog.com/blogs/jamie_thomson/rsscomments.aspx?PostID=47006</wfw:comment><description>&lt;p&gt;In SQL Server Data Tools (SSDT) one way to create a new object is to right click on a folder in Solution Explorer and point to Add. Doing so will display this menu:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_20905F62.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_0215F8AC.png" width="505" height="203" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;A number of options are offered for creating a brand new object (“function”, “table”, “stored proc” etc…) and one of them is “Script”. If your preference is to handcraft the DDL for every database object without resorting to a GUI then you may choose to use the “Script” option because, after all, every file is just a DDL script – why not write the thing from scratch? There is however one fundamental difference between the Script” option and all the other options that you should be aware of.&lt;/p&gt;  &lt;p&gt;For the screenshot below I added a script and handcrafted a simple CREATE TABLE statement:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/SNAGHTML760417d0_6BDFDD59.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="SNAGHTML760417d0" border="0" alt="SNAGHTML760417d0" src="http://sqlblog.com/blogs/jamie_thomson/SNAGHTML760417d0_thumb_6D44002B.png" width="778" height="359" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Notice that the table is defined in the dbo schema but it is not appearing in SQL Server Object Explorer under the dbo schema node. Why is that? The answer is actually pretty simple. If I select Script1.sql in Solution Explorer and hit F4 the properties window appears and we see this:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_3686A527.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_7C97623A.png" width="304" height="276" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;The Build Action property of the file is set to “None” which means that the file does not get included in a build and hence any objects defined within that file will not appear in our database. This is the default behaviour when you Add as script whereas the default behaviour when you explicitly add an object is to set Build Action=Build. That is the fundamental difference between adding a script and adding a specific object.&lt;/p&gt;  &lt;p&gt;This is one of those nuances of SSDT that is an easy problem to spot when you know about it but can cause you to spend hours hunting around for a solution if you do not (believe me, I’ve been there). Be aware of it!&lt;/p&gt;  &lt;p&gt;&lt;a href="http://twitter.com/jamiet" target="_blank"&gt;@Jamiet&lt;/a&gt;&lt;/p&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=47006" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/Datadude/default.aspx">Datadude</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/sql+server/default.aspx">sql server</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/SSDT/default.aspx">SSDT</category></item><item><title>Warning! Publish may fail on creation of a FOREIGN KEY constraint and then immediately succeed [SSDT]</title><link>http://sqlblog.com/blogs/jamie_thomson/archive/2013/01/03/warning-publish-may-fail-on-creation-of-a-foreign-key-constraint-and-then-immediately-succeed-ssdt.aspx</link><pubDate>Thu, 03 Jan 2013 12:15:06 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:46978</guid><dc:creator>jamiet</dc:creator><slash:comments>0</slash:comments><comments>http://sqlblog.com/blogs/jamie_thomson/comments/46978.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/jamie_thomson/commentrss.aspx?PostID=46978</wfw:commentRss><wfw:comment>http://sqlblog.com/blogs/jamie_thomson/rsscomments.aspx?PostID=46978</wfw:comment><description>&lt;p&gt;I have stumbled across a nuance of SSDT that other users should be cognizant of. I published an SSDT database project onto an existing database that already had data in it but that Publish operation failed:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_71C1CD88.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_02C5FB6C.png" width="492" height="135" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;The error message was:&lt;/p&gt;  &lt;blockquote&gt;   &lt;pre&gt;&lt;font color="#ff0000"&gt;(10036,1): SQL72014: .Net SqlClient Data Provider: Msg 547, Level 16, State 0, Line 1 &lt;br /&gt;The ALTER TABLE statement conflicted with the FOREIGN KEY constraint &lt;br /&gt;&amp;quot;ActualsDay_fct_ent_CustomerHierarchyLvl03_FK_PayTo&amp;quot;. &lt;br /&gt;The conflict occurred in database &amp;quot;PM_EDW&amp;quot;, table &amp;quot;ent.CustomerHierarchyLvl03&amp;quot;, column &lt;br /&gt;'CstHierLvl03_EK'.&lt;/font&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;The command that caused the error was:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre style="text-align:left;list-style-type:disc;font-family:;background:white;color:;"&gt;&lt;font face="Consolas"&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size:9.8pt;"&gt;ALTER&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:9.8pt;"&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;TABLE&lt;/font&gt;&lt;/span&gt; [fct]&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;[ActualsDay] &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;WITH&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;CHECK&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;CHECK&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;CONSTRAINT&lt;/font&gt;&lt;/span&gt; [ActualsDay_fct_ent_CustomerHierarchyLvl03_FK_PayTo]&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;;&lt;/font&gt;&lt;/span&gt;
&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;In other words SSDT created a FOREIGN KEY constraint in my database and then attempted to check that existing data satisfied that constraint (hence the &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;WITH&lt;/font&gt;&lt;/span&gt; &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;CHECK&lt;/font&gt;&lt;/span&gt; of the command above). There was some data that violated that constraint and the Publish operation failed.

  &lt;br /&gt;This is good, I definitely want a Publish operation to fail under these circumstances.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;em&gt;If you want to understand more about &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;WITH&lt;/font&gt;&lt;/span&gt; &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;CHECK&lt;/font&gt;&lt;/span&gt; take a read of &lt;/em&gt;&lt;a href="http://consultingblogs.emc.com/jamiethomson/archive/2006/02/17/SSIS_3A00_-How-to-load-related-tables.aspx" target="_blank"&gt;&lt;em&gt;How to load related tables&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A problem occurred though when I next published because that Publish operation actually succeeded:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_41B77C07.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_07C8391B.png" width="490" height="134" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;even though &lt;strong&gt;I hadn’t changed anything in the project&lt;/strong&gt;! If I check out the metadata of that FOREIGN KEY:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre style="text-align:left;list-style-type:disc;font-family:;background:white;color:;"&gt;&lt;font face="Consolas"&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size:9.8pt;"&gt;SELECT&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style="font-size:9.8pt;"&gt;	name&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;/span&gt;is_not_trusted
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;FROM&lt;/font&gt;&lt;/span&gt;	&lt;span style="color:;"&gt;&lt;font color="#008000"&gt;sys&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#808080"&gt;.&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#008000"&gt;foreign_keys&lt;/font&gt;&lt;/span&gt;&amp;#160; &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;WHERE&lt;/font&gt;&lt;/span&gt;	name &lt;span style="color:;"&gt;&lt;font color="#808080"&gt;=&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span style="color:;"&gt;&lt;font color="#ff0000"&gt;'ActualsDay_fct_ent_CustomerHierarchyLvl03_FK_PayTo'&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;I see that [is_not_trusted] equals 1.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_18CC66FE.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_30EFD159.png" width="469" height="192" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;What does that mean, exactly? Well, SSMS’s table designer provides more useful information:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_16AF6835.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_4E81AC58.png" width="548" height="346" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;[is_not_trusted] means that my new FOREIGN KEY constraint has been created but the existing data has not been checked for compliance. Ouch! Not good, not good at all!&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;What’s going on here? If we break down the individual steps it becomes evident:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;First Publish operation starts&lt;/li&gt;

  &lt;li&gt;FOREIGN KEY constraint gets created but without the WITH CHECK option&lt;/li&gt;

  &lt;li&gt;FOREIGN KEY constraint is ALTERed to have the WITH CHECK option. This fails due to existing data violating the constraint and hence the entire Publish operation fails&lt;/li&gt;

  &lt;li&gt;Second Publish operation starts&lt;/li&gt;

  &lt;li&gt;Publish engine only checks to see that the FOREIGN KEY constraint exists, which it does. Hence, no action is taken&lt;/li&gt;

  &lt;li&gt;Second Publish operation succeeds and I’m left with data that violates a newly created FOREIGN KEY constraint&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This sequence of events can leave your database in a dangerous state and hence is something that SSDT users should be aware of. In my opinion this is a bug and I have raised it as such on Microsoft Connect: &lt;a href="https://connect.microsoft.com/SQLServer/feedback/details/775683/ssdt-bug-publish-will-fail-due-to-fk-constraint-and-then-succeed-immediately-after" target="_blank"&gt;[SSDT bug] Publish will fail due to FK constraint and then succeed immediately after&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Be aware, be very aware!&lt;/p&gt;

&lt;p&gt;&lt;a href="http://twitter.com/jamiet" target="_blank"&gt;@Jamiet&lt;/a&gt;&lt;/p&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=46978" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/sql+server/default.aspx">sql server</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/SSDT/default.aspx">SSDT</category></item><item><title>Query for server DefaultData &amp; DefaultLog folders</title><link>http://sqlblog.com/blogs/jamie_thomson/archive/2012/12/10/query-for-server-defaultdata-defaultlog-folders.aspx</link><pubDate>Mon, 10 Dec 2012 12:10:35 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:46579</guid><dc:creator>jamiet</dc:creator><slash:comments>2</slash:comments><comments>http://sqlblog.com/blogs/jamie_thomson/comments/46579.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/jamie_thomson/commentrss.aspx?PostID=46579</wfw:commentRss><wfw:comment>http://sqlblog.com/blogs/jamie_thomson/rsscomments.aspx?PostID=46579</wfw:comment><description>&lt;p&gt;Do you ever need to query for the DefaultData &amp;amp; DefaultLog folders for your SQL Server instance? Well, I just did and the following script enabled me to do that:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color="#0000ff"&gt;DECLARE &lt;/font&gt;&lt;font color="#434343"&gt;@HkeyLocal &lt;/font&gt;&lt;font color="#0000ff"&gt;NVARCHAR&lt;/font&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;18&lt;/font&gt;&lt;font color="#808080"&gt;),&lt;/font&gt;&lt;font color="#434343"&gt;@MSSqlServerRegPath &lt;/font&gt;&lt;font color="#0000ff"&gt;NVARCHAR&lt;/font&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;31&lt;/font&gt;&lt;font color="#808080"&gt;),&lt;/font&gt;&lt;font color="#434343"&gt;@InstanceRegPath &lt;/font&gt;&lt;font color="#0000ff"&gt;SYSNAME&lt;/font&gt;&lt;font color="#808080"&gt;;        &lt;br /&gt;        &lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff"&gt;SELECT &lt;/font&gt;&lt;font color="#434343"&gt;@HkeyLocal&lt;/font&gt;&lt;font color="#0000ff"&gt;=&lt;/font&gt;&lt;font color="#ff0000"&gt;N'HKEY_LOCAL_MACHINE'        &lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff"&gt;SELECT &lt;/font&gt;&lt;font color="#434343"&gt;@MSSqlServerRegPath&lt;/font&gt;&lt;font color="#0000ff"&gt;=&lt;/font&gt;&lt;font color="#ff0000"&gt;N'SOFTWARE\Microsoft\MSSQLServer'        &lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff"&gt;SELECT &lt;/font&gt;&lt;font color="#434343"&gt;@InstanceRegPath&lt;/font&gt;&lt;font color="#0000ff"&gt;=&lt;/font&gt;&lt;font color="#434343"&gt;@MSSqlServerRegPath &lt;/font&gt;&lt;font color="#808080"&gt;+ &lt;/font&gt;&lt;font color="#ff0000"&gt;N'\MSSQLServer'        &lt;br /&gt;        &lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff"&gt;DECLARE &lt;/font&gt;&lt;font color="#434343"&gt;@SmoDefaultFile &lt;/font&gt;&lt;font color="#0000ff"&gt;NVARCHAR&lt;/font&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;512&lt;/font&gt;&lt;font color="#808080"&gt;)        &lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff"&gt;EXEC MASTER&lt;/font&gt;&lt;font color="#000000"&gt;.dbo.&lt;/font&gt;&lt;font color="#8b0000"&gt;xp_instance_regread &lt;/font&gt;&lt;font color="#434343"&gt;@HkeyLocal&lt;/font&gt;&lt;font color="#808080"&gt;, &lt;/font&gt;&lt;font color="#434343"&gt;@InstanceRegPath&lt;/font&gt;&lt;font color="#808080"&gt;, &lt;/font&gt;&lt;font color="#ff0000"&gt;N'DefaultData'&lt;/font&gt;&lt;font color="#808080"&gt;, &lt;/font&gt;&lt;font color="#434343"&gt;@SmoDefaultFile &lt;/font&gt;&lt;font color="#000000"&gt;OUTPUT        &lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff"&gt;DECLARE &lt;/font&gt;&lt;font color="#434343"&gt;@SmoDefaultLog &lt;/font&gt;&lt;font color="#0000ff"&gt;NVARCHAR&lt;/font&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;font color="#000000"&gt;512&lt;/font&gt;&lt;font color="#808080"&gt;)        &lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff"&gt;EXEC MASTER&lt;/font&gt;&lt;font color="#000000"&gt;.dbo.&lt;/font&gt;&lt;font color="#8b0000"&gt;xp_instance_regread &lt;/font&gt;&lt;font color="#434343"&gt;@HkeyLocal&lt;/font&gt;&lt;font color="#808080"&gt;, &lt;/font&gt;&lt;font color="#434343"&gt;@InstanceRegPath&lt;/font&gt;&lt;font color="#808080"&gt;, &lt;/font&gt;&lt;font color="#ff0000"&gt;N'DefaultLog'&lt;/font&gt;&lt;font color="#808080"&gt;, &lt;/font&gt;&lt;font color="#434343"&gt;@SmoDefaultLog &lt;/font&gt;&lt;font color="#000000"&gt;OUTPUT        &lt;br /&gt;        &lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff"&gt;SELECT &lt;/font&gt;&lt;font color="#ff00ff"&gt;ISNULL&lt;/font&gt;&lt;font color="#808080"&gt;(&lt;/font&gt;&lt;font color="#434343"&gt;@SmoDefaultFile&lt;/font&gt;&lt;font color="#808080"&gt;,&lt;/font&gt;&lt;font color="#ff0000"&gt;N'') AS [DefaultFile],ISNULL(@SmoDefaultLog,N'') AS [DefaultLog]'&lt;/font&gt; &lt;/p&gt;    &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_739C2F49.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_72C3C95F.png" width="330" height="126" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;I haven’t done any rigorous testing or anything like that, all I can say is…it worked for me (on SQL Server 2012). Use as you see fit.&lt;/p&gt;  &lt;p&gt;Doubtless this information exists in a multitude of other places but nevertheless I’m putting it here so I know where to find it in the future.&lt;/p&gt;  &lt;p&gt;   &lt;hr /&gt;&lt;/p&gt;  &lt;p&gt;Just for fun I thought I’d try this out against &lt;strike&gt;SQL Azure&lt;/strike&gt; Windows Azure SQL Database. Unsurprisingly it didn’t work there:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color="#ff0000"&gt;Msg 40515, Level 15, State 1, Line 16       &lt;br /&gt;Reference to database and/or server name in 'MASTER.dbo.xp_instance_regread' is not supported in this version of SQL Server.&lt;/font&gt;      &lt;br /&gt;&lt;/p&gt;    &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_31B549FB.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_7EE54386.png" width="697" height="76" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;a href="http://twitter.com/jamiet" target="_blank"&gt;@Jamiet&lt;/a&gt;&lt;/p&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=46579" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/sql+server/default.aspx">sql server</category></item><item><title>The perils of double-dash comments [T-SQL]</title><link>http://sqlblog.com/blogs/jamie_thomson/archive/2012/12/06/the-perils-of-double-dash-comments-t-sql.aspx</link><pubDate>Thu, 06 Dec 2012 09:21:39 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:46531</guid><dc:creator>jamiet</dc:creator><slash:comments>17</slash:comments><comments>http://sqlblog.com/blogs/jamie_thomson/comments/46531.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/jamie_thomson/commentrss.aspx?PostID=46531</wfw:commentRss><wfw:comment>http://sqlblog.com/blogs/jamie_thomson/rsscomments.aspx?PostID=46531</wfw:comment><description>&lt;p&gt;I was checking my Twitter feed on my way in to work this morning and was alerted to an interesting blog post by &lt;a href="https://twitter.com/ValentinoV42" target="_blank"&gt;Valentino Vranken&lt;/a&gt; that highlights a problem regarding the OLE DB Source in SSIS. In short, using double-dash comments in SQL statements within the OLE DB Source can cause unexpected results. It really is quite an important read if you’re developing SSIS packages so head over to &lt;a href="http://blog.hoegaerden.be/2012/12/05/ssis-ole-db-source-parameters-and-comments-a-dangerous-mix/?utm_source=feedburner&amp;amp;utm_medium=feed&amp;amp;utm_campaign=Feed%3A+ADevelopersBlog+%28A+Developer%27s+Blog%29" target="_blank"&gt;SSIS OLE DB Source, Parameters And Comments: A Dangerous Mix!&lt;/a&gt; and be educated. Note that the problem is solved in SSIS2012 and Valentino explains exactly why.&lt;/p&gt;  &lt;p&gt;If reading Valentino’s post has switched your brain into “learn mode” perhaps also check out my post &lt;a href="http://consultingblogs.emc.com/jamiethomson/archive/2006/02/21/SSIS_3A00_-SELECT-_2A002E002E002E00_-or-select-from-a-dropdown-in-an-OLE-DB-Source-component_3F00_.aspx" target="_blank"&gt;SSIS: SELECT *... or select from a dropdown in an OLE DB Source component?&lt;/a&gt; which highlights another issue to be aware of when using the OLE DB Source.&lt;/p&gt;  &lt;p&gt;As I was reading Valentino’s post I was reminded of a slidedeck by &lt;a href="https://twitter.com/ChrisAdkin8" target="_blank"&gt;Chris Adkin&lt;/a&gt; entitled &lt;a href="http://www.slideshare.net/chris1adkin/t-sql-coding-guidelines" target="_blank"&gt;T-SQL Coding Guidelines&lt;/a&gt; where he recommends never using double-dash comments:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_5157145A.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_3DC9B4B9.png" width="330" height="277" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;That’s good advice!&lt;/p&gt;  &lt;p&gt;&lt;a href="http://twitter.com/jamiet" target="_blank"&gt;@Jamiet&lt;/a&gt;&lt;/p&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=46531" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/sql+server/default.aspx">sql server</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/sql+server+integration+services/default.aspx">sql server integration services</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/ssis/default.aspx">ssis</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/t-sql/default.aspx">t-sql</category></item></channel></rss>