<?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 : XPath, sql server integration services, xquery, nugget</title><link>http://sqlblog.com/blogs/jamie_thomson/archive/tags/XPath/sql+server+integration+services/xquery/nugget/default.aspx</link><description>Tags: XPath, sql server integration services, xquery, nugget</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>SSIS Package Stats Collector version 2</title><link>http://sqlblog.com/blogs/jamie_thomson/archive/2009/11/07/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><slash:comments>12</slash:comments><comments>http://sqlblog.com/blogs/jamie_thomson/comments/18599.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/jamie_thomson/commentrss.aspx?PostID=18599</wfw:commentRss><wfw:comment>http://sqlblog.com/blogs/jamie_thomson/rsscomments.aspx?PostID=18599</wfw:comment><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;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=18599" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/t-sql/default.aspx">t-sql</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/nugget/default.aspx">nugget</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/xquery/default.aspx">xquery</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/SSISPackageStatsCollector/default.aspx">SSISPackageStatsCollector</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/XML/default.aspx">XML</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/XPath/default.aspx">XPath</category></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><slash:comments>32</slash:comments><comments>http://sqlblog.com/blogs/jamie_thomson/comments/17904.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/jamie_thomson/commentrss.aspx?PostID=17904</wfw:commentRss><wfw:comment>http://sqlblog.com/blogs/jamie_thomson/rsscomments.aspx?PostID=17904</wfw:comment><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;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=17904" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/t-sql/default.aspx">t-sql</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/nugget/default.aspx">nugget</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/xquery/default.aspx">xquery</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/SSISPackageStatsCollector/default.aspx">SSISPackageStatsCollector</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/XML/default.aspx">XML</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/XPath/default.aspx">XPath</category></item></channel></rss>