<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlblog.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Search results matching tag 'XPath'</title><link>http://sqlblog.com/search/SearchResults.aspx?o=DateDescending&amp;tag=XPath&amp;orTags=0</link><description>Search results matching tag 'XPath'</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>Editing sqlcmdvariable nodes in SSDT Publish Profile files using msbuild</title><link>http://sqlblog.com/blogs/jamie_thomson/archive/2012/12/10/editing-sqlcmdvariable-nodes-in-ssdt-publish-profile-files-using-msbuild.aspx</link><pubDate>Mon, 10 Dec 2012 13:42:51 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:46580</guid><dc:creator>jamiet</dc:creator><description>&lt;p&gt;Publish profile files are a new feature of SSDT database projects that enable you to package up all environment-specific properties into a single file for use at publish time; I have written about them before at &lt;a href="http://sqlblog.com/blogs/jamie_thomson/archive/2012/05/08/publish-profile-files-in-sql-server-data-tools-ssdt.aspx" target="_blank"&gt;Publish Profile Files in SQL Server Data Tools (SSDT)&lt;/a&gt; and if it wasn’t obvious from that blog post, I’m a big fan!&lt;/p&gt;  &lt;p&gt;As I have used Publish Profile files more and more I have realised that there may be times when you need to edit those Publish profile files during your build process, you may think of such an operation as a kind of pre-processor step. In my case I have a sqlcmd variable called DeployTag, it holds a value representing the current build number that later gets inserted into a table using a Post-Deployment script (that’s a technique that I wrote about in &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" target="_blank"&gt;Implementing SQL Server solutions using Visual Studio 2010 Database Projects – a compendium of project experiences&lt;/a&gt; – search for “Putting a build number into the DB”).&lt;/p&gt;  &lt;p&gt;Here are the contents of my Publish Profile file (simplified for demo purposes) :&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_79CBFB00.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_38BD7B9C.png" width="669" height="218" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Notice that DeployTag defaults to “UNKNOWN”.&lt;/p&gt;  &lt;p&gt;On my current project we are using msbuild scripts to control what gets built and what I want to do is take the build number from our build engine and edit the Publish profile files accordingly. Here is the pertinent portion of the the msbuild script I came up with to do that:&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;&amp;#160; &amp;lt;&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="#a31515"&gt;ItemGroup&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#a31515"&gt;Namespaces&lt;/font&gt;&lt;/span&gt;&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="#ff0000"&gt;Include&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;=&lt;/font&gt;&lt;/span&gt;&amp;quot;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;myns&lt;/font&gt;&lt;/span&gt;&amp;quot;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#a31515"&gt;Prefix&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt;myns&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;lt;/&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#a31515"&gt;Prefix&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#a31515"&gt;Uri&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt;http://schemas.microsoft.com/developer/msbuild/2003&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;lt;/&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#a31515"&gt;Uri&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#a31515"&gt;Namespaces&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;#160; &amp;lt;/&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#a31515"&gt;ItemGroup&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt;
 
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;#160; &amp;lt;&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#a31515"&gt;Target&lt;/font&gt;&lt;/span&gt;&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="#ff0000"&gt;Name&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;=&lt;/font&gt;&lt;/span&gt;&amp;quot;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;UpdateBuildNumber&lt;/font&gt;&lt;/span&gt;&amp;quot;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#a31515"&gt;ItemGroup&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#a31515"&gt;SSDTPublishFiles&lt;/font&gt;&lt;/span&gt;&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="#ff0000"&gt;Include&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;=&lt;/font&gt;&lt;/span&gt;&amp;quot;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;$(DESTINATION)\**\$(CONFIGURATION)\**\*.publish.xml&lt;/font&gt;&lt;/span&gt;&amp;quot;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt; /&amp;gt;&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#a31515"&gt;ItemGroup&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#a31515"&gt;MSBuild.ExtensionPack.Xml.XmlFile&lt;/font&gt;&lt;/span&gt;&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="#ff0000"&gt;Condition&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;=&lt;/font&gt;&lt;/span&gt;&amp;quot;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;%(SSDTPublishFiles.Identity) != ''&lt;/font&gt;&lt;/span&gt;&amp;quot;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#ff0000"&gt;TaskAction&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;=&lt;/font&gt;&lt;/span&gt;&amp;quot;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;UpdateElement&lt;/font&gt;&lt;/span&gt;&amp;quot;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#ff0000"&gt;File&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;=&lt;/font&gt;&lt;/span&gt;&amp;quot;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;%(SSDTPublishFiles.Identity)&lt;/font&gt;&lt;/span&gt;&amp;quot;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#ff0000"&gt;Namespaces&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;=&lt;/font&gt;&lt;/span&gt;&amp;quot;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;@(Namespaces)&lt;/font&gt;&lt;/span&gt;&amp;quot;&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="#0000ff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#ff0000"&gt;XPath&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;=&lt;/font&gt;&lt;/span&gt;&amp;quot;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;//myns:SqlCmdVariable[@Include='DeployTag']/myns:Value&lt;/font&gt;&lt;/span&gt;&amp;quot;&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="#0000ff"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#ff0000"&gt;InnerText&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;=&lt;/font&gt;&lt;/span&gt;&amp;quot;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;$(BuildNumber)&lt;/font&gt;&lt;/span&gt;&amp;quot;&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;/&amp;gt;&lt;/font&gt;&lt;/span&gt;
&lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;&amp;#160; &amp;lt;/&lt;/font&gt;&lt;/span&gt;&lt;span style="color:;"&gt;&lt;font color="#a31515"&gt;Target&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="color:;"&gt;&lt;font style="font-size:9.8pt;" color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;The important bits here are the definition of the namespace &lt;a href="http://schemas.microsoft.com/developer/msbuild/2003"&gt;http://schemas.microsoft.com/developer/msbuild/2003&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_3B83308F.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_2F81405B.png" width="507" height="109" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;and the XPath expression &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;//myns:SqlCmdVariable[@Include='DeployTag']/myns:Value&lt;/font&gt;&lt;/span&gt;:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_076E913C.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_4D7F4E4F.png" width="691" height="104" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Some extra info:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;I use a fantastic tool called XMLPad to discover/test XPath expressions, read more at &lt;a href="http://sqlblog.com/blogs/jamie_thomson/archive/2011/02/11/xmlpad-a-new-tool-in-my-developer-utility-belt.aspx" target="_blank"&gt;XMLPad – a new tool in my developer utility belt&lt;/a&gt;&lt;span style="color:;"&gt;&lt;font color="#a31515"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/li&gt;

  &lt;li&gt;&lt;span style="color:;"&gt;&lt;font color="#a31515"&gt;MSBuild.ExtensionPack.Xml.XmlFile &lt;/font&gt;&lt;/span&gt;is a msbuild task used to edit XML files and is available from &lt;a href="https://twitter.com/MikeFourie" target="_blank"&gt;Mike Fourie&lt;/a&gt;’s &lt;a href="http://msbuildextensionpack.codeplex.com/" target="_blank"&gt;MSBuild Extension Pack&lt;/a&gt;&lt;/li&gt;

  &lt;li&gt;I’m using a property called &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;$(BuildNumber)&lt;/font&gt;&lt;/span&gt; to hold the value to substitute into the file and also &lt;span style="color:;"&gt;&lt;font color="#0000ff"&gt;$(DESTINATION)\**\$(CONFIGURATION)\**\*.publish.xml&lt;/font&gt;&lt;/span&gt; to define an ItemGroup all of my Publish Profile files. Populating those properties is basic msbuild stuff and is therefore outside the scope of this blog post however if you want to learn more check out &lt;a href="http://msdn.microsoft.com/en-us/library/ms171458(v=vs.80).aspx" target="_blank"&gt;MSBuild properties&lt;/a&gt; &amp;amp; &lt;a href="http://msdn.microsoft.com/en-us/library/ms171454(v=vs.80).aspx" target="_blank"&gt;How To: Use Wildcards to Build All Files in a Directory&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hope this is useful!&lt;/p&gt;

&lt;p&gt;&lt;a href="http://twitter.com/jamiet" target="_blank"&gt;@Jamiet&lt;/a&gt;&lt;/p&gt;</description></item><item><title>XMLPad – a new tool in my developer utility belt</title><link>http://sqlblog.com/blogs/jamie_thomson/archive/2011/02/11/xmlpad-a-new-tool-in-my-developer-utility-belt.aspx</link><pubDate>Fri, 11 Feb 2011 19:22:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:33426</guid><dc:creator>jamiet</dc:creator><description>&lt;P&gt;Yesterday I was on the lookout for a free tool that would help me write XPath statements. I put a shout out on Twitter and &lt;A href="http://twitter.com/#!/JohanBarnard" target=_blank&gt;Johan Barnard&lt;/A&gt; &lt;A href="http://twitter.com/#!/JohanBarnard/status/34987912051294208" target=_blank&gt;replied&lt;/A&gt; saying :&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT size=5&gt;Give XMLPad a try &lt;/FONT&gt;&lt;A href="http://www.wmhelp.com/xmlpad3.htm"&gt;&lt;FONT size=5&gt;http://www.wmhelp.com/xmlpad3.htm&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;A href="http://sqlblog.com/blogs/jamie_thomson/image_0E60889F.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_5D7DD133.png" width=561 height=296&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I’m sure there are legions of developers out there that know all about XMLPad but I had never heard about it so I suspect some of you reading haven’t either. Today I downloaded it to give it a run out and I gotta say – I love it. I only used it to do one thing –constructing an XPath expression to point to a particular Configuration definition in a .dtsx file- and it allowed me to do that with consummate ease. The feature I particularly loved was that, similar to Google Suggest, it showed me results from my expression as I typed.&lt;/P&gt;
&lt;P&gt;Here is a screenshot of my XPath expression to find (and just try saying this in a hurry)&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;the value of a property whose DTS:Name attribute equals ‘ConfigurationString’ of a Configuration definition where the value of that Configuration definition’s property whose DTS:Name attribute equals ‘ObjectName’, equals ‘BIConfig&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG title="Evaluate XPath in XMLPad" alt="Evaluate XPath in XMLPad" src="http://s3.amazonaws.com/twitpic/photos/full/239622156.png?AWSAccessKeyId=0ZRYP5X5F6FSMBCCSE82&amp;amp;Expires=1297452183&amp;amp;Signature=PQ4iEwEtSE6m7Yd5%2F3%2FYz99Xf6E%3D" width=770 height=237&gt;&lt;/P&gt;
&lt;P&gt;My XPath expression:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT size=3 face=Consolas&gt;/DTS:Executable/DTS:Configuration[DTS:Property[@DTS:Name=’ObjectName’]=’BIConfig’]/DTS:Property[@DTS:Name=’ConfigurationString’]&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;and believe me, there was no way I would have been able to come up with that without a tool to help me!&lt;/P&gt;
&lt;P&gt;So, an easy tip for you – if you need to write XPath expression download XMLPad for free from &lt;A title=http://www.wmhelp.com/xmlpad3.htm href="http://www.wmhelp.com/xmlpad3.htm"&gt;http://www.wmhelp.com/xmlpad3.htm&lt;/A&gt; and see what it can do for you. &lt;/P&gt;
&lt;P&gt;That’s all. Its now Friday evening and I’m shutting down and relaxing before heading to the &lt;A href="http://www.skysports.com/story/0,19528,12040_6745474,00.html" target=_blank&gt;big game at Twickenham tomorrow&lt;/A&gt; (yes, I have a ticket &lt;IMG style="BORDER-BOTTOM-STYLE:none;BORDER-LEFT-STYLE:none;BORDER-TOP-STYLE:none;BORDER-RIGHT-STYLE:none;" class="wlEmoticon wlEmoticon-smile" alt=Smile src="http://sqlblog.com/blogs/jamie_thomson/wlEmoticon-smile_1C031EDA.png"&gt; ). Have a good one!&lt;/P&gt;
&lt;P&gt;&lt;A href="http://twitter.com/jamiet"&gt;@Jamiet&lt;/A&gt;&lt;/P&gt;</description></item><item><title>SSIS Package Stats Collector version 2</title><link>http://sqlblog.com/blogs/jamie_thomson/archive/2009/11/06/ssis-package-stats-collector-version-2.aspx</link><pubDate>Sat, 07 Nov 2009 01:58:24 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:18599</guid><dc:creator>jamiet</dc:creator><description>&lt;p&gt;A few weeks ago I published a blog entitled &lt;a href="http://sqlblog.com/blogs/jamie_thomson/archive/2009/10/18/collecting-information-about-your-ssis-packages-ssis-nugget.aspx"&gt;Collecting information about your SSIS packages&lt;/a&gt; which demonstrated a way that you could use T-SQL and XQuery to derive information about your SSIS packages. Since then I’ve made a few amendments to the script that accompanied that blog post as follows:&lt;/p&gt;  &lt;h4&gt;New columns&lt;/h4&gt;  &lt;p&gt;The collected data now includes the following information about your packages:    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; PackageId     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; PackageXML&amp;#160; (The XML that forms the .dtsx file)     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; NumberOfContainers     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; NumberOfDataflows     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; NumberOfConnectionManagers     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; NumberOfVariablesInEntirePackage&lt;/p&gt;  &lt;h4&gt;New feature&lt;/h4&gt;  &lt;p&gt;Returns a list of non-unique GUIDs and the packages that they appear in. If a GUID appears more than once in the same package it tells us how many times&lt;/p&gt;  &lt;h4&gt;Bug fixes&lt;/h4&gt;  &lt;p&gt;If there were no tasks in the package no data would be returned. That is now no longer the case.    &lt;br /&gt;Previous version didn’t work on case-sensitive collations, should be OK now.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;There are also more comments liberally sprinkled around it now as well!&lt;/p&gt;  &lt;p&gt;Here’s a screenshot showing some of those new columns:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_53C348EA.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_32BFB076.png" width="846" height="212" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Returning [PackageId] as a field is an important addition because we can now very easily see if any of our packages share the same Package Id. Package IDs are supposed to be unique but if they are not then they are a problem waiting to happen and unfortunately Business Intelligence Design Studio (BIDS) doesn’t really protect you against it very well,&amp;#160; in fact if you use package templates then its very likely that you have non unique GUIDs somewhere. (“Non unique globally unique identifiers” – that should set the alarm bells ringing if nothing else).&lt;/p&gt;  &lt;p&gt;As alluded to above the script now returns a brand new dataset showing all the GUIDs that occur more than once across all of your packages. Now, I’m not just talking about PackageId GUIDs here, every single object in a SSIS package be it a task, container, component, variable, connection manager, column, whatever… has a GUID attached to it and given the healthy amount of copy-and-paste that goes on when developing SSIS packages its a sure bet that some of those GUIDs are going to get repeated somewhere. Of course, its up to you whether you want to do anything about it or not – if you’re a purist then the idea of repeated GUIDs might keep you awake at night although I suspect most people simply won’t care. Still, its there if you need it:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_0DFE7332.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_37B1C858.png" width="918" height="223" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;You may wonder why I have the [NumberOfTimeshisGUIDOccursInThisPackage] column in there. Well, its perfectly plausible that the a GUID can reoccur in the same package and in fact when I was testing this earlier on today I had a package that had 6 occurrences of a GUID because it contained 6 near-identical connection managers that had obviously been copied-and-pasted.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;That’s it for now. Let me know if this script proves useful to you and let me know if there’s anything you’d like to see added to it. Download the latest version from: &lt;a title="http://cid-550f681dad532637.skydrive.live.com/self.aspx/Public/BlogShare/20091105/SSISPackageStatsCollector%5E_v2.sql" href="http://cid-550f681dad532637.skydrive.live.com/self.aspx/Public/BlogShare/20091105/SSISPackageStatsCollector%5E_v2.sql"&gt;http://cid-550f681dad532637.skydrive.live.com/self.aspx/Public/BlogShare/20091105/SSISPackageStatsCollector%5E_v2.sql&lt;/a&gt;. I have also dropped it into &lt;a href="http://consultingblogs.emc.com/jamiethomson/archive/tags/sqlmesh/default.aspx"&gt;SQLMesh&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Looking forward to some feedback (hint hint).&lt;/p&gt;  &lt;p&gt;&lt;a href="http://twitter.com/jamiet"&gt;@Jamiet&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Collecting information about your SSIS packages [SSIS Nugget]</title><link>http://sqlblog.com/blogs/jamie_thomson/archive/2009/10/18/collecting-information-about-your-ssis-packages-ssis-nugget.aspx</link><pubDate>Sun, 18 Oct 2009 21:08:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:17904</guid><dc:creator>jamiet</dc:creator><description>&lt;p&gt;Did you know that is is possible to read the contents of a SSIS package (i.e. a .dtsx file) from within SQL Server Management Studio (SSMS) using T-SQL? For example, take the following T-SQL snippet:&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;&lt;pre style="BORDER-BOTTOM-STYLE:none;TEXT-ALIGN:left;PADDING-BOTTOM:0px;LINE-HEIGHT:12pt;BORDER-RIGHT-STYLE:none;BACKGROUND-COLOR:#f4f4f4;MARGIN:0em;PADDING-LEFT:0px;WIDTH:100%;PADDING-RIGHT:0px;FONT-FAMILY:'Courier New', courier, monospace;DIRECTION:ltr;BORDER-TOP-STYLE:none;COLOR:black;FONT-SIZE:8pt;BORDER-LEFT-STYLE:none;OVERFLOW:visible;PADDING-TOP:0px;" id="codeSnippet"&gt;&lt;span style="COLOR:#0000ff;"&gt;select&lt;/span&gt;    &lt;span style="COLOR:#0000ff;"&gt;cast&lt;/span&gt;(BulkColumn &lt;span style="COLOR:#0000ff;"&gt;as&lt;/span&gt; XML)&lt;br&gt;&lt;span style="COLOR:#0000ff;"&gt;from&lt;/span&gt;    &lt;span style="COLOR:#0000ff;"&gt;openrowset&lt;/span&gt;(&lt;span style="COLOR:#0000ff;"&gt;bulk&lt;/span&gt; &lt;span style="COLOR:#006080;"&gt;'C:\tmp\MyPkg.dtsx'&lt;/span&gt;,&lt;br&gt;                        single_blob) &lt;span style="COLOR:#0000ff;"&gt;as&lt;/span&gt; pkgColumn;&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;
&lt;p&gt;It uses &lt;a href="http://msdn.microsoft.com/en-us/library/ms190312.aspx"&gt;OPENROWSET&lt;/a&gt; to return the contents of a specified package (&lt;font face="Courier New"&gt;C:\tmp\MyPkg.dtsx&lt;/font&gt;) as an XML document. Here is a screenshot showing what this returns:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_597DE8D8.png"&gt;&lt;img src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_38AC90D5.png" style="BORDER-RIGHT-WIDTH:0px;DISPLAY:inline;BORDER-TOP-WIDTH:0px;BORDER-BOTTOM-WIDTH:0px;BORDER-LEFT-WIDTH:0px;" title="dtsx package XML ssis" alt="dtsx package XML ssis" height="81" width="353" border="0"&gt;&lt;/a&gt; &lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;and clicking on that result opens up the following:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_70F0294F.png"&gt;&lt;img src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_5D8A05B4.png" style="BORDER-RIGHT-WIDTH:0px;DISPLAY:inline;BORDER-TOP-WIDTH:0px;BORDER-BOTTOM-WIDTH:0px;BORDER-LEFT-WIDTH:0px;" title="dts package xml screenshot ssis" alt="dts package xml screenshot ssis" height="291" width="802" border="0"&gt;&lt;/a&gt; &lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;That’s what the inards of a .dtsx file look like. In other words we now have a queryable XML document representing a package, thereafter you’re limited only to what you can do with XQuery which is quite a lot. Now, I’m no XQuery expert by any means but I did manage to find a few uses for this. Here are some sample queries:&lt;/p&gt;
&lt;h3&gt;All properties of a package&lt;/h3&gt;
&lt;div&gt;&lt;pre style="BORDER-BOTTOM-STYLE:none;TEXT-ALIGN:left;PADDING-BOTTOM:0px;LINE-HEIGHT:12pt;BORDER-RIGHT-STYLE:none;BACKGROUND-COLOR:#f4f4f4;MARGIN:0em;PADDING-LEFT:0px;WIDTH:100%;PADDING-RIGHT:0px;FONT-FAMILY:'Courier New', courier, monospace;DIRECTION:ltr;BORDER-TOP-STYLE:none;COLOR:black;FONT-SIZE:8pt;BORDER-LEFT-STYLE:none;OVERFLOW:visible;PADDING-TOP:0px;" id="codeSnippet"&gt;&lt;span style="COLOR:#0000ff;"&gt;SELECT&lt;/span&gt;    Props.Prop.query(&lt;span style="COLOR:#006080;"&gt;'.'&lt;/span&gt;)                                                        &lt;span style="COLOR:#0000ff;"&gt;as&lt;/span&gt; PropXml&lt;br&gt;,        Props.Prop.&lt;span style="COLOR:#0000ff;"&gt;value&lt;/span&gt;(&lt;span style="COLOR:#006080;"&gt;'declare namespace p1="www.microsoft.com/SqlServer/Dts";&lt;br&gt;                            string(./@p1:Name)'&lt;/span&gt;,&lt;span style="COLOR:#006080;"&gt;'nvarchar(max)'&lt;/span&gt;)                    &lt;span style="COLOR:#0000ff;"&gt;as&lt;/span&gt; PropName&lt;br&gt;,        Props.Prop.&lt;span style="COLOR:#0000ff;"&gt;value&lt;/span&gt;(&lt;span style="COLOR:#006080;"&gt;'.'&lt;/span&gt;, &lt;span style="COLOR:#006080;"&gt;'nvarchar(max)'&lt;/span&gt;)                                        &lt;span style="COLOR:#0000ff;"&gt;as&lt;/span&gt; PropValue&lt;br&gt;&lt;span style="COLOR:#0000ff;"&gt;FROM&lt;/span&gt;    (&lt;br&gt;        &lt;span style="COLOR:#0000ff;"&gt;SELECT&lt;/span&gt;    &lt;span style="COLOR:#0000ff;"&gt;CAST&lt;/span&gt;(pkgblob.BulkColumn &lt;span style="COLOR:#0000ff;"&gt;AS&lt;/span&gt; XML) pkgXML&lt;br&gt;        &lt;span style="COLOR:#0000ff;"&gt;FROM&lt;/span&gt;    &lt;span style="COLOR:#0000ff;"&gt;OPENROWSET&lt;/span&gt;(&lt;span style="COLOR:#0000ff;"&gt;bulk&lt;/span&gt; &lt;span style="COLOR:#006080;"&gt;'C:\tmp\MyPkg.dtsx'&lt;/span&gt;,single_blob) &lt;span style="COLOR:#0000ff;"&gt;AS&lt;/span&gt; pkgblob&lt;br&gt;        ) t&lt;br&gt;&lt;span style="COLOR:#0000ff;"&gt;CROSS&lt;/span&gt;    APPLY pkgXML.nodes(&lt;span style="COLOR:#006080;"&gt;'declare namespace DTS="www.microsoft.com/SqlServer/Dts";&lt;br&gt;                        /DTS:Executable/DTS:Property'&lt;/span&gt;) Props(Prop)&lt;br&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;blockquote&gt;
&lt;div&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_172F3050.png"&gt;&lt;img src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_22EEBA46.png" style="BORDER-RIGHT-WIDTH:0px;DISPLAY:inline;BORDER-TOP-WIDTH:0px;BORDER-BOTTOM-WIDTH:0px;BORDER-LEFT-WIDTH:0px;" title="dtsx properties xml ssis" alt="dtsx properties xml ssis" height="207" width="820" border="0"&gt;&lt;/a&gt; &lt;/div&gt;&lt;/blockquote&gt;
&lt;div&gt;&lt;i&gt;I had &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/sqlxml/thread/871099bf-532a-4eab-b8ed-f96d701fe6da"&gt;a lot of help&lt;/a&gt; from &lt;/i&gt;&lt;a href="http://twitter.com/rbarryyoung"&gt;&lt;i&gt;@rbarryyoung&lt;/i&gt;&lt;/a&gt;&lt;i&gt; with this one!&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;h3&gt;Name and type of every task in a package&lt;/h3&gt;
&lt;div id="codeSnippetWrapper"&gt;&lt;pre style="BORDER-BOTTOM-STYLE:none;TEXT-ALIGN:left;PADDING-BOTTOM:0px;LINE-HEIGHT:12pt;BORDER-RIGHT-STYLE:none;BACKGROUND-COLOR:#f4f4f4;MARGIN:0em;PADDING-LEFT:0px;WIDTH:100%;PADDING-RIGHT:0px;FONT-FAMILY:'Courier New', courier, monospace;DIRECTION:ltr;BORDER-TOP-STYLE:none;COLOR:black;FONT-SIZE:8pt;BORDER-LEFT-STYLE:none;OVERFLOW:visible;PADDING-TOP:0px;" id="codeSnippet"&gt;&lt;span style="COLOR:#0000ff;"&gt;SELECT&lt;/span&gt;    Pkg.props.&lt;span style="COLOR:#0000ff;"&gt;value&lt;/span&gt;(&lt;span style="COLOR:#006080;"&gt;'declare namespace p1="www.microsoft.com/SqlServer/Dts";&lt;br&gt;                            ./p1:Property[@p1:Name='&lt;/span&gt;&lt;span style="COLOR:#006080;"&gt;'ObjectName'&lt;/span&gt;&lt;span style="COLOR:#006080;"&gt;'][1]'&lt;/span&gt;,&lt;span style="COLOR:#006080;"&gt;'nvarchar(max)'&lt;/span&gt;) &lt;span style="COLOR:#0000ff;"&gt;as&lt;/span&gt; TaskName&lt;br&gt;,        Pkg.props.&lt;span style="COLOR:#0000ff;"&gt;value&lt;/span&gt;(&lt;span style="COLOR:#006080;"&gt;'declare namespace p1="www.microsoft.com/SqlServer/Dts";&lt;br&gt;                            ./@p1:ExecutableType'&lt;/span&gt;,&lt;span style="COLOR:#006080;"&gt;'nvarchar(max)'&lt;/span&gt;) &lt;span style="COLOR:#0000ff;"&gt;as&lt;/span&gt; TaskType&lt;br&gt;&lt;span style="COLOR:#0000ff;"&gt;FROM&lt;/span&gt;    (&lt;br&gt;        &lt;span style="COLOR:#0000ff;"&gt;select&lt;/span&gt;    &lt;span style="COLOR:#0000ff;"&gt;cast&lt;/span&gt;(pkgblob.BulkColumn &lt;span style="COLOR:#0000ff;"&gt;as&lt;/span&gt; XML) pkgXML&lt;br&gt;        &lt;span style="COLOR:#0000ff;"&gt;from&lt;/span&gt;    &lt;span style="COLOR:#0000ff;"&gt;openrowset&lt;/span&gt;(&lt;span style="COLOR:#0000ff;"&gt;bulk&lt;/span&gt; &lt;span style="COLOR:#006080;"&gt;'C:\tmp\Package.dtsx'&lt;/span&gt;,single_blob) &lt;span style="COLOR:#0000ff;"&gt;as&lt;/span&gt; pkgblob&lt;br&gt;        ) t&lt;br&gt;&lt;span style="COLOR:#0000ff;"&gt;CROSS&lt;/span&gt;    APPLY pkgXML.nodes(&lt;span style="COLOR:#006080;"&gt;'declare namespace DTS="www.microsoft.com/SqlServer/Dts";&lt;br&gt;                            //DTS:Executable[@DTS:ExecutableType!='&lt;/span&gt;&lt;span style="COLOR:#006080;"&gt;'STOCK:SEQUENCE'&lt;/span&gt;&lt;span style="COLOR:#006080;"&gt;'&lt;br&gt;                        and    @DTS:ExecutableType!='&lt;/span&gt;&lt;span style="COLOR:#006080;"&gt;'STOCK:FORLOOP'&lt;/span&gt;&lt;span style="COLOR:#006080;"&gt;'&lt;br&gt;                        and    @DTS:ExecutableType!='&lt;/span&gt;&lt;span style="COLOR:#006080;"&gt;'STOCK:FOREACHLOOP'&lt;/span&gt;&lt;span style="COLOR:#006080;"&gt;'&lt;br&gt;                        and not(contains(@DTS:ExecutableType,'&lt;/span&gt;&lt;span style="COLOR:#006080;"&gt;'.Package.'&lt;/span&gt;&lt;span style="COLOR:#006080;"&gt;'))]'&lt;/span&gt;) Pkg(props)&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;
&lt;blockquote&gt;
&lt;div&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_004D0C7C.png"&gt;&lt;img src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_38A87CD6.png" style="BORDER-RIGHT-WIDTH:0px;DISPLAY:inline;BORDER-TOP-WIDTH:0px;BORDER-BOTTOM-WIDTH:0px;BORDER-LEFT-WIDTH:0px;" title="All tasks in a dtsx package file" alt="All tasks in a dtsx package file" height="232" width="524" border="0"&gt;&lt;/a&gt; &lt;/div&gt;&lt;/blockquote&gt;
&lt;div&gt;&lt;i&gt;Note that this one will also return all tasks that exist in eventhandlers and it ignores how “deep” a task is in the &lt;a href="http://consultingblogs.emc.com/jamiethomson/archive/2004/12/13/445.aspx"&gt;container hierarchy&lt;/a&gt;.&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;h3&gt;Putting it all together&lt;/h3&gt;
&lt;div&gt;Ok, that’s all pretty cool but it would be nice to combine it all together and get a summary of many packages, perhaps all of the packages on your machine. Hence I’ve put together a T-SQL script that will display summary information about all of the packages in a folder and its subfolders. Here’s the results of running that script on my dev machine:&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_43BCBFF1.png"&gt;&lt;img src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_082C1557.png" style="BORDER-BOTTOM:0px;BORDER-LEFT:0px;DISPLAY:inline;BORDER-TOP:0px;BORDER-RIGHT:0px;" title="ssis package statistics information" alt="ssis package statistics information" height="253" width="875" border="0"&gt;&lt;/a&gt; &lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;
&lt;div&gt;217 packages – I’ve collected lot of them over the years! This shows a sampling of some of the information that it is possible to collect:&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Package name &lt;/li&gt;
&lt;li&gt;Original creator of the package &lt;/li&gt;
&lt;li&gt;Package Type (signifies which version of BIDS was used to originally build it) &lt;/li&gt;
&lt;li&gt;Version numbers &lt;/li&gt;
&lt;li&gt;Number of tasks in the package &lt;/li&gt;&lt;/ul&gt;
&lt;div&gt;Want to know what your most complex package might be? Simply order this dataset in descending order of [NumberOfTasks]. Or maybe you want to know which of your developers has built the most packages – the answers are right here!&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;Of course, this could be extended to capture much much more information than what I have captured here. You may want to know how many eventhandlers each of your packages has, when the packages were created, or perhaps how many components are in your dataflows. The (SSIS) world is your oyster!!!&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;One thing that I thought would be &lt;i&gt;very&lt;/i&gt; useful would be to stick this script into a SQL Agent job, run it on a daily basis, and insert the results into a history table thereby giving you a running history of all the packages in your system and when they changed. If anyone does do that let me know how it goes!&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;To execute the script simply open it and change the following line as appropriate:&lt;/div&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;blockquote&gt;&lt;pre style="BORDER-BOTTOM-STYLE:none;TEXT-ALIGN:left;PADDING-BOTTOM:0px;LINE-HEIGHT:12pt;BORDER-RIGHT-STYLE:none;BACKGROUND-COLOR:#f4f4f4;MARGIN:0em;PADDING-LEFT:0px;WIDTH:100%;PADDING-RIGHT:0px;FONT-FAMILY:'Courier New', courier, monospace;DIRECTION:ltr;BORDER-TOP-STYLE:none;COLOR:black;FONT-SIZE:8pt;BORDER-LEFT-STYLE:none;OVERFLOW:visible;PADDING-TOP:0px;" id="codeSnippet"&gt;&lt;span style="COLOR:#0000ff;"&gt;DECLARE&lt;/span&gt;    @&lt;span style="COLOR:#0000ff;"&gt;Path&lt;/span&gt;    &lt;span style="COLOR:#0000ff;"&gt;VARCHAR&lt;/span&gt;(2000) = &lt;span style="COLOR:#006080;"&gt;'C:\*.dtsx'&lt;/span&gt;;&lt;/pre&gt;&lt;/blockquote&gt;&lt;/div&gt;
&lt;div&gt;Note that you will need to enable [xp_cmdshell] in order to run the script which&amp;nbsp; is available on my SkyDrive at:&lt;/div&gt;
&lt;div&gt;&lt;a href="http://cid-550f681dad532637.skydrive.live.com/self.aspx/Public/BlogShare/20091018/SSISPackageStatsCollector.sql" title="http://cid-550f681dad532637.skydrive.live.com/self.aspx/Public/BlogShare/20091018/SSISPackageStatsCollector.sql"&gt;http://cid-550f681dad532637.skydrive.live.com/self.aspx/Public/BlogShare/20091018/SSISPackageStatsCollector.sql&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;If you experience any problems with it let me know. If you adapt it any way let me know that too because writing these XQuery statements is no easy task (believe me!!!) and it would be great to share that stuff with other people!&lt;/div&gt;
&lt;p&gt;&lt;a href="http://twitter.com/jamiet"&gt;@JamieT&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Update: The original version of this script only worked on SQL Server 2008. I have now updated it so that it works on SQL2005 also! Thanks to Bruce in the comments for alerting me to this fact/&lt;/p&gt;
&lt;p&gt;Update 2: Found a few more issues and hence have uploaded another new version (same link still works though). Changes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Script will now work on a server with a case-sensitive collation&lt;/li&gt;
&lt;li&gt;xp_cmdshell is turned on at the top of the script&lt;/li&gt;
&lt;li&gt;An error message that could get returned by the command-line call under certain circumstances wasn't getting handled. It is now!&lt;/li&gt;&lt;/ul&gt;Update 3: An updated version with bug fixes and new features is now available at &lt;a href="http://sqlblog.com/blogs/jamie_thomson/archive/2009/11/07/ssis-package-stats-collector-version-2.aspx"&gt;SSIS Package Stats Collector version 2
		
	&lt;/a&gt;</description></item><item><title>XML Optimization Presentation Sample Code</title><link>http://sqlblog.com/blogs/michael_coles/archive/2009/05/16/xml-optimization-presentation-sample-code.aspx</link><pubDate>Sat, 16 May 2009 11:13:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:14102</guid><dc:creator>Mike C</dc:creator><description>&lt;P&gt;During the XML Optimization presentation today I'll refer back to the sample code posted at &lt;SPAN style="FONT-FAMILY:Calibri;COLOR:black;FONT-SIZE:12pt;mso-ascii-font-family:Calibri;mso-color-index:1;mso-font-kerning:12.0pt;language:en-US;"&gt;&lt;A href="http://www.apress.com/book/downloadfile/4021"&gt;http://www.apress.com/book/downloadfile/4021&lt;/A&gt;.&amp;nbsp; &lt;/SPAN&gt;I'll also update this post with additional sample code by tomorrow.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;UPDATE:&lt;/STRONG&gt; The PowerPoint presentation and sample code are attached to this post in the ZIP file.&lt;/P&gt;
&lt;P&gt;Jacob Sebastian's book "The Art of XSD" is available here: &lt;A href="http://www.red-gate.com/specials/Ebooks/XSD_0409.htm"&gt;&lt;FONT color=#02469b&gt;http://www.red-gate.com/specials/Ebooks/XSD_0409.htm&lt;/FONT&gt;&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Thanks to everyone who turned out for the NJSQL Performance Tuning Saturday event today, and thanks to Melissa for coordinating it!&lt;/P&gt;
&lt;P&gt;NJSQL website: &lt;A href="http://njsql.org/Default.aspx"&gt;http://njsql.org/Default.aspx&lt;/A&gt;&lt;/P&gt;</description></item></channel></rss>