<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>SSIS</title>
        <link>http://geekswithblogs.net/LifeLongTechie/category/10634.aspx</link>
        <description>SSIS</description>
        <language>en-US</language>
        <copyright>Kevin Shyr</copyright>
        <managingEditor>kevinshyr@gmail.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>SSIS Tools</title>
            <link>http://geekswithblogs.net/LifeLongTechie/archive/2011/11/03/ssis-tools.aspx</link>
            <description>&lt;p&gt;Somebody told me this and I'm ready to try some of the components:&lt;/p&gt;
&lt;p&gt;http://www.konesans.com/products.aspx&lt;/p&gt;
&lt;p&gt;FileWatcher, Regex Clean, RowNumber Transform&lt;/p&gt; &lt;img src="http://geekswithblogs.net/LifeLongTechie/aggbug/147549.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Kevin Shyr</dc:creator>
            <guid>http://geekswithblogs.net/LifeLongTechie/archive/2011/11/03/ssis-tools.aspx</guid>
            <pubDate>Thu, 03 Nov 2011 20:03:37 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LifeLongTechie/comments/147549.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LifeLongTechie/archive/2011/11/03/ssis-tools.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/LifeLongTechie/comments/commentRss/147549.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/LifeLongTechie/services/trackbacks/147549.aspx</trackback:ping>
        </item>
        <item>
            <title>SSIS design consideration</title>
            <link>http://geekswithblogs.net/LifeLongTechie/archive/2011/10/25/ssis-design-consideration.aspx</link>
            <description>&lt;p&gt;The following is my experience with SSIS building:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;Make sure you understand the 3 modes of Lookup.  General, I would only do full cache if the lookup table only return less than 200 rows&lt;/li&gt;
    &lt;li&gt;Never use the table or view select unless you really need every field on that table or view.
    &lt;ul&gt;
        &lt;li&gt;select * from a data source will break in the future if more columns are added to the table&lt;/li&gt;
        &lt;li&gt;select * in a lookup brings back unnecessary fields and impact performance&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;Never use "Sort" in SSIS unless it's absolutely necessary.  Sort in database first.
    &lt;ul&gt;
        &lt;li&gt;Merge join requires sorted input; you can do order by in your select, then configure the output to specify the "sorted" column.&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;Transaction matters.  If you only need to read data, use the snapshot option to ensure fastest reading and without blocking the table.&lt;/li&gt;
    &lt;li&gt;Don't use config file unless you are sharing values across multiple packages.  Not using config files makes the packages more dynamic as values can be set though SQL Job or xp_cmdshell&lt;/li&gt;
    &lt;li&gt;Now that I've mentioned it, don't use xp_cmdshell to start package unless you have to.  By properly storing variables in well constructed tables should eliminate the need to dynamically pass in values.&lt;/li&gt;
    &lt;li&gt;use variable value expression instead of using script task to set values&lt;/li&gt;
    &lt;li&gt;Just like in T-SQL, don't do a select with 15 tables joined together.  Do an insert of the key first, then update the destination table.&lt;/li&gt;
    &lt;li&gt;Learn C# (well, for 2008 or later, otherwise, learn VB as well)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Enjoy your SSIS project!&lt;/p&gt; &lt;img src="http://geekswithblogs.net/LifeLongTechie/aggbug/147456.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Kevin Shyr</dc:creator>
            <guid>http://geekswithblogs.net/LifeLongTechie/archive/2011/10/25/ssis-design-consideration.aspx</guid>
            <pubDate>Wed, 26 Oct 2011 03:16:37 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LifeLongTechie/comments/147456.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LifeLongTechie/archive/2011/10/25/ssis-design-consideration.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/LifeLongTechie/comments/commentRss/147456.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/LifeLongTechie/services/trackbacks/147456.aspx</trackback:ping>
        </item>
        <item>
            <title>Monitoring BizTalk Server Without SCCM, using SQL query</title>
            <link>http://geekswithblogs.net/LifeLongTechie/archive/2011/09/14/monitoring-biztalk-server-without-sccm-using-sql-query.aspx</link>
            <description>&lt;p&gt;For the environment that does not have SCCM to monitor BizTalk server health, the following SQL query can be incorporate into a SQL job and have BizTalk server at least on a "constant" check.&lt;/p&gt;
&lt;p&gt;Note: be aware that the following was tested only against a single suspended instance with a send port.  Since BizTalk SQL server does not allow select against the ServiceClass table, I couldn't use a single table join.  With the data I currently have, I am not 100% sure the Receive Port, Pipeline, Orchestration parts work.&lt;/p&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt; &lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;color:blue;"&gt;SELECT&lt;/span&gt;&lt;span style="font-size:10.0pt;Courier New&amp;quot;;"&gt; &lt;span style="color:blue"&gt;TOP&lt;/span&gt; 1000 &lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;      _M&lt;span style="color:gray"&gt;.&lt;/span&gt;nvcName &lt;span style="color:blue"&gt;AS&lt;/span&gt; ApplicationName&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;      &lt;span style="color:gray"&gt;,&lt;/span&gt; &lt;span style="color:blue"&gt;CASE&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;            &lt;span style="color:blue"&gt;WHEN&lt;/span&gt; _BSP&lt;span style="color:gray"&gt;.&lt;/span&gt;nvcName &lt;span style="color:gray"&gt;IS&lt;/span&gt; &lt;span style="color:gray"&gt;NOT&lt;/span&gt; &lt;span style="color:gray"&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;                  &lt;span style="color:blue"&gt;THEN&lt;/span&gt; &lt;span style="color:red"&gt;'Send Port: '&lt;/span&gt; &lt;span style="color:gray"&gt;+&lt;/span&gt; _BSP&lt;span style="color:gray"&gt;.&lt;/span&gt;nvcName&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;            &lt;span style="color:blue"&gt;WHEN&lt;/span&gt; _BSP&lt;span style="color:gray"&gt;.&lt;/span&gt;nvcName &lt;span style="color:gray"&gt;IS&lt;/span&gt; &lt;span style="color:gray"&gt;NOT&lt;/span&gt; &lt;span style="color:gray"&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;                  &lt;span style="color:blue"&gt;THEN&lt;/span&gt; &lt;span style="color:red"&gt;'Receive Port: '&lt;/span&gt; &lt;span style="color:gray"&gt;+&lt;/span&gt; _BSP&lt;span style="color:gray"&gt;.&lt;/span&gt;nvcName&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;            &lt;span style="color:blue"&gt;WHEN&lt;/span&gt; _BPL&lt;span style="color:gray"&gt;.&lt;/span&gt;Name &lt;span style="color:gray"&gt;IS&lt;/span&gt; &lt;span style="color:gray"&gt;NOT&lt;/span&gt; &lt;span style="color:gray"&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;                  &lt;span style="color:blue"&gt;THEN&lt;/span&gt; &lt;span style="color:red"&gt;'Pipeline: '&lt;/span&gt; &lt;span style="color:gray"&gt;+&lt;/span&gt; _BPL&lt;span style="color:gray"&gt;.&lt;/span&gt;Name&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;            &lt;span style="color:blue"&gt;WHEN&lt;/span&gt; _BO&lt;span style="color:gray"&gt;.&lt;/span&gt;nvcName &lt;span style="color:gray"&gt;IS&lt;/span&gt; &lt;span style="color:gray"&gt;NOT&lt;/span&gt; &lt;span style="color:gray"&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;                  &lt;span style="color:blue"&gt;THEN&lt;/span&gt; &lt;span style="color:red"&gt;'Orchestration: '&lt;/span&gt; &lt;span style="color:gray"&gt;+&lt;/span&gt; _BO&lt;span style="color:gray"&gt;.&lt;/span&gt;nvcName&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;            &lt;span style="color:blue"&gt;ELSE&lt;/span&gt; &lt;span style="color:red"&gt;'Unknown'&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;      &lt;span style="color:blue"&gt;END&lt;/span&gt; &lt;span style="color:blue"&gt;AS&lt;/span&gt; ServiceName&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;      &lt;span style="color:gray"&gt;,&lt;/span&gt; _IS&lt;span style="color:gray"&gt;.&lt;/span&gt;dtCreated&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;      &lt;span style="color:gray"&gt;,&lt;/span&gt; _IS&lt;span style="color:gray"&gt;.&lt;/span&gt;dtSuspendTimeStamp&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;      &lt;span style="color:gray"&gt;,&lt;/span&gt; _IS&lt;span style="color:gray"&gt;.&lt;/span&gt;nvcAdapter&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;      &lt;span style="color:gray"&gt;,&lt;/span&gt; _IS&lt;span style="color:gray"&gt;.&lt;/span&gt;nvcURI&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;      &lt;span style="color:gray"&gt;,&lt;/span&gt; _IS&lt;span style="color:gray"&gt;.&lt;/span&gt;nvcErrorDescription&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;      &lt;span style="color:gray"&gt;,&lt;/span&gt; _IS&lt;span style="color:gray"&gt;.&lt;/span&gt;nvcErrorProcessingServer&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;color:blue;"&gt;FROM&lt;/span&gt;&lt;span style="font-size:10.0pt;Courier New&amp;quot;;"&gt; [BizTalkMsgBoxDb]&lt;span style="color:gray"&gt;.&lt;/span&gt;[dbo]&lt;span style="color:gray"&gt;.&lt;/span&gt;[InstancesSuspended] &lt;span style="color:blue"&gt;AS&lt;/span&gt; _IS &lt;span style="color:blue"&gt;WITH&lt;/span&gt;&lt;span style="color:gray"&gt;(&lt;/span&gt;&lt;span style="color:blue"&gt;READPAST&lt;/span&gt;&lt;span style="color:gray"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;      &lt;span style="color:gray"&gt;INNER&lt;/span&gt; &lt;span style="color:gray"&gt;JOIN&lt;/span&gt; [BizTalkMsgBoxDb]&lt;span style="color:gray"&gt;.&lt;/span&gt;[dbo]&lt;span style="color:gray"&gt;.&lt;/span&gt;[Services] &lt;span style="color:blue"&gt;AS&lt;/span&gt; _S &lt;span style="color:blue"&gt;WITH&lt;/span&gt;&lt;span style="color:gray"&gt;(&lt;/span&gt;&lt;span style="color:blue"&gt;READPAST&lt;/span&gt;&lt;span style="color:gray"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;            &lt;span style="color:blue"&gt;ON&lt;/span&gt; _IS&lt;span style="color:gray"&gt;.&lt;/span&gt;[uidServiceID] &lt;span style="color:gray"&gt;=&lt;/span&gt; _S&lt;span style="color:gray"&gt;.&lt;/span&gt;uidServiceID&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;      &lt;span style="color:gray"&gt;INNER&lt;/span&gt; &lt;span style="color:gray"&gt;JOIN&lt;/span&gt; [BizTalkMsgBoxDb]&lt;span style="color:gray"&gt;.&lt;/span&gt;[dbo]&lt;span style="color:gray"&gt;.&lt;/span&gt;[Modules] &lt;span style="color:blue"&gt;AS&lt;/span&gt; _M &lt;span style="color:blue"&gt;WITH&lt;/span&gt;&lt;span style="color:gray"&gt;(&lt;/span&gt;&lt;span style="color:blue"&gt;READPAST&lt;/span&gt;&lt;span style="color:gray"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;            &lt;span style="color:blue"&gt;ON&lt;/span&gt; _S&lt;span style="color:gray"&gt;.&lt;/span&gt;nModuleID &lt;span style="color:gray"&gt;=&lt;/span&gt; _M&lt;span style="color:gray"&gt;.&lt;/span&gt;nModuleID&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;      &lt;span style="color:gray"&gt;LEFT&lt;/span&gt; &lt;span style="color:gray"&gt;OUTER&lt;/span&gt; &lt;span style="color:gray"&gt;JOIN&lt;/span&gt; [BizTalkMgmtDb]&lt;span style="color:gray"&gt;.&lt;/span&gt;[dbo]&lt;span style="color:gray"&gt;.&lt;/span&gt;[bts_sendport] &lt;span style="color:blue"&gt;AS&lt;/span&gt; _BSP &lt;span style="color:blue"&gt;WITH&lt;/span&gt;&lt;span style="color:gray"&gt;(&lt;/span&gt;&lt;span style="color:blue"&gt;READPAST&lt;/span&gt;&lt;span style="color:gray"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;            &lt;span style="color:blue"&gt;ON&lt;/span&gt; _IS&lt;span style="color:gray"&gt;.&lt;/span&gt;uidServiceID &lt;span style="color:gray"&gt;=&lt;/span&gt; _BSP&lt;span style="color:gray"&gt;.&lt;/span&gt;uidGUID&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;      &lt;span style="color:gray"&gt;LEFT&lt;/span&gt; &lt;span style="color:gray"&gt;OUTER&lt;/span&gt; &lt;span style="color:gray"&gt;JOIN&lt;/span&gt; [BizTalkMgmtDb]&lt;span style="color:gray"&gt;.&lt;/span&gt;[dbo]&lt;span style="color:gray"&gt;.&lt;/span&gt;[bts_receiveport] &lt;span style="color:blue"&gt;AS&lt;/span&gt; _BRP &lt;span style="color:blue"&gt;WITH&lt;/span&gt;&lt;span style="color:gray"&gt;(&lt;/span&gt;&lt;span style="color:blue"&gt;READPAST&lt;/span&gt;&lt;span style="color:gray"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;            &lt;span style="color:blue"&gt;ON&lt;/span&gt; _IS&lt;span style="color:gray"&gt;.&lt;/span&gt;uidServiceID &lt;span style="color:gray"&gt;=&lt;/span&gt; _BRP&lt;span style="color:gray"&gt;.&lt;/span&gt;uidGUID&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;      &lt;span style="color:gray"&gt;LEFT&lt;/span&gt; &lt;span style="color:gray"&gt;OUTER&lt;/span&gt; &lt;span style="color:gray"&gt;JOIN&lt;/span&gt; [BizTalkMgmtDb]&lt;span style="color:gray"&gt;.&lt;/span&gt;[dbo]&lt;span style="color:gray"&gt;.&lt;/span&gt;[bts_pipeline] &lt;span style="color:blue"&gt;AS&lt;/span&gt; _BPL &lt;span style="color:blue"&gt;WITH&lt;/span&gt;&lt;span style="color:gray"&gt;(&lt;/span&gt;&lt;span style="color:blue"&gt;READPAST&lt;/span&gt;&lt;span style="color:gray"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;            &lt;span style="color:blue"&gt;ON&lt;/span&gt; _IS&lt;span style="color:gray"&gt;.&lt;/span&gt;uidServiceID &lt;span style="color:gray"&gt;=&lt;/span&gt; _BPL&lt;span style="color:gray"&gt;.&lt;/span&gt;PipelineID&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;      &lt;span style="color:gray"&gt;LEFT&lt;/span&gt; &lt;span style="color:gray"&gt;OUTER&lt;/span&gt; &lt;span style="color:gray"&gt;JOIN&lt;/span&gt; [BizTalkMgmtDb]&lt;span style="color:gray"&gt;.&lt;/span&gt;[dbo]&lt;span style="color:gray"&gt;.&lt;/span&gt;[bts_orchestration] &lt;span style="color:blue"&gt;AS&lt;/span&gt; _BO &lt;span style="color:blue"&gt;WITH&lt;/span&gt;&lt;span style="color:gray"&gt;(&lt;/span&gt;&lt;span style="color:blue"&gt;READPAST&lt;/span&gt;&lt;span style="color:gray"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;            &lt;span style="color:blue"&gt;ON&lt;/span&gt; _IS&lt;span style="color:gray"&gt;.&lt;/span&gt;uidServiceID &lt;span style="color:gray"&gt;=&lt;/span&gt; _BO&lt;span style="color:gray"&gt;.&lt;/span&gt;uidGUID&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;color:blue;"&gt;WHERE&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom:0in;margin-bottom:.0001pt;line-height:&amp;#xD;&amp;#xA;normal;text-autospace:none"&gt;&lt;span style="font-size:&amp;#xD;&amp;#xA;10.0pt;Courier New&amp;quot;;"&gt;      _M&lt;span style="color:gray"&gt;.&lt;/span&gt;nvcName &lt;span style="color:gray"&gt;=&lt;/span&gt; &lt;span style="color:red"&gt;'Your application name'&lt;/span&gt; &lt;span style="color:green"&gt;-- change application name here to monitor different applications&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;p&gt; &lt;/p&gt; &lt;img src="http://geekswithblogs.net/LifeLongTechie/aggbug/146891.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Kevin Shyr</dc:creator>
            <guid>http://geekswithblogs.net/LifeLongTechie/archive/2011/09/14/monitoring-biztalk-server-without-sccm-using-sql-query.aspx</guid>
            <pubDate>Thu, 15 Sep 2011 03:37:04 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LifeLongTechie/comments/146891.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LifeLongTechie/archive/2011/09/14/monitoring-biztalk-server-without-sccm-using-sql-query.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/LifeLongTechie/comments/commentRss/146891.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/LifeLongTechie/services/trackbacks/146891.aspx</trackback:ping>
        </item>
        <item>
            <title>Frustration and rewards on using SSIS Pivot and Unpivot</title>
            <link>http://geekswithblogs.net/LifeLongTechie/archive/2011/05/20/frustration-and-rewards-on-using-ssis-pivot-and-unpivot.aspx</link>
            <description>&lt;p&gt;Granted, if you are just transforming data in the same SQL server, why would you do it in SSIS instead of just using Pivot and Unpivot in T-SQL query?  But what about in the case where data comes from various sources?&lt;/p&gt;
&lt;p&gt;What I had fun doing was the ability to skip using Linked server, pull in data from different sources, like XML over web service.  Another point that made me happy was the ability to simulate ROW_NUMBER() function with the merged data by using a Script Component.&lt;/p&gt;
&lt;p&gt;Anyway, I highly recommend everyone to try this out.  It's very frustrating throughout the process, but the result is very rewarding.  &lt;img alt="" src="http://geekswithblogs.net/Providers/BlogEntryEditor/FCKeditor/editor/images/smiley/msn/regular_smile.gif" /&gt;&lt;/p&gt;
&lt;p&gt;Pivot:  &lt;a href="http://msdn.microsoft.com/en-us/library/ms140308.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms140308.aspx&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Unpivot:  &lt;a href="http://msdn.microsoft.com/en-us/library/ms141723.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms141723.aspx&lt;/a&gt;&lt;/p&gt; &lt;img src="http://geekswithblogs.net/LifeLongTechie/aggbug/145464.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Kevin Shyr</dc:creator>
            <guid>http://geekswithblogs.net/LifeLongTechie/archive/2011/05/20/frustration-and-rewards-on-using-ssis-pivot-and-unpivot.aspx</guid>
            <pubDate>Fri, 20 May 2011 20:36:30 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LifeLongTechie/comments/145464.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LifeLongTechie/archive/2011/05/20/frustration-and-rewards-on-using-ssis-pivot-and-unpivot.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/LifeLongTechie/comments/commentRss/145464.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/LifeLongTechie/services/trackbacks/145464.aspx</trackback:ping>
        </item>
        <item>
            <title>Parallel programming in Visual Studio</title>
            <link>http://geekswithblogs.net/LifeLongTechie/archive/2011/03/31/parallel-programming-in-visual-studio.aspx</link>
            <description>&lt;p&gt;Not much experience with these products yet.&lt;/p&gt;
&lt;p&gt;Free:  http://developer.nvidia.com/object/nsight.html&lt;/p&gt;
&lt;p&gt;Not free:  http://software.intel.com/en-us/articles/intel-parallel-studio-purchase/&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;For SSIS, this looks very interesting:&lt;/p&gt;
&lt;p&gt;http://extendedssispkgexec.codeplex.com/&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt; &lt;img src="http://geekswithblogs.net/LifeLongTechie/aggbug/144617.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Kevin Shyr</dc:creator>
            <guid>http://geekswithblogs.net/LifeLongTechie/archive/2011/03/31/parallel-programming-in-visual-studio.aspx</guid>
            <pubDate>Thu, 31 Mar 2011 17:26:03 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LifeLongTechie/comments/144617.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LifeLongTechie/archive/2011/03/31/parallel-programming-in-visual-studio.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/LifeLongTechie/comments/commentRss/144617.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/LifeLongTechie/services/trackbacks/144617.aspx</trackback:ping>
        </item>
        <item>
            <title>Using BizTalk to bridge SQL Job and Human Intervention (Requesting Permission)</title>
            <link>http://geekswithblogs.net/LifeLongTechie/archive/2011/02/04/using-biztalk-to-bridge-sql-job-and-human-intervention-requesting.aspx</link>
            <description>&lt;p&gt;I start off the process with either a BizTalk Scheduler (http://biztalkscheduledtask.codeplex.com/releases/view/50363) or a manual file drop of the XML message.  The manual file drop is to allow the SQL &lt;/p&gt;
&lt;p&gt;Job to call a "File Copy" SSIS step to copy the trigger file for the next process and allows SQL &lt;/p&gt;
&lt;p&gt;Job to be linked back into BizTalk processing.&lt;/p&gt;
&lt;p&gt;The Process Trigger XML looks like the following.  It is basically the configuration hub of the business process&lt;/p&gt;
&lt;p&gt;&amp;lt;ns0:MsgSchedulerTriggerSQLJobReceive xmlns:ns0="urn:com:something something"&amp;gt;&lt;br /&gt;
  &amp;lt;ns0:IsProcessAsync&amp;gt;YES&amp;lt;/ns0:IsProcessAsync&amp;gt;&lt;br /&gt;
  &amp;lt;ns0:IsPermissionRequired&amp;gt;YES&amp;lt;/ns0:IsPermissionRequired&amp;gt;&lt;br /&gt;
  &amp;lt;ns0:BusinessProcessName&amp;gt;Data Push&amp;lt;/ns0:BusinessProcessName&amp;gt; &lt;br /&gt;
  &amp;lt;ns0:EmailFrom&amp;gt;DoNotReply@company.com&amp;lt;/ns0:EmailFrom&amp;gt;&lt;br /&gt;
  &amp;lt;ns0:EmailRecipientToList&amp;gt;ProjectManagers@company.com&amp;lt;/ns0:EmailRecipientToList&amp;gt;&lt;br /&gt;
  &amp;lt;ns0:EmailRecipientCCList&amp;gt;Developers@company.com&amp;lt;/ns0:EmailRecipientCCList&amp;gt;&lt;br /&gt;
  &amp;lt;ns0:EmailMessageBodyForPermissionRequest&amp;gt;This message was sent to request permission to start the Data Push process.  The SQL Job to be run is WeeklyProcessing_DataPush&amp;lt;/ns0:EmailMessageBodyForPermissionRequest&amp;gt;&lt;br /&gt;
  &amp;lt;ns0:SQLJobName&amp;gt;WeeklyProcessing_DataPush&amp;lt;/ns0:SQLJobName&amp;gt;&lt;br /&gt;
  &amp;lt;ns0:SQLJobStepName&amp;gt;Push_To_Production&amp;lt;/ns0:SQLJobStepName&amp;gt;&lt;br /&gt;
  &amp;lt;ns0:SQLJobMinToWait&amp;gt;1&amp;lt;/ns0:SQLJobMinToWait&amp;gt;&lt;br /&gt;
  &amp;lt;ns0:PermissionRequestTriggerPath&amp;gt;\\server\ETL-BizTalk\Automation\TriggerCreatedByBizTalk\&amp;lt;/ns0:PermissionRequestTriggerPath&amp;gt;&lt;br /&gt;
  &amp;lt;ns0:PermissionRequestApprovedPath&amp;gt;\\server\ETL-BizTalk\Automation\Approved\&amp;lt;/ns0:PermissionRequestApprovedPath&amp;gt;&lt;br /&gt;
  &amp;lt;ns0:PermissionRequestNotApprovedPath&amp;gt;\\server\ETL-BizTalk\Automation\NotApproved\&amp;lt;/ns0:PermissionRequestNotApprovedPath&amp;gt;&lt;br /&gt;
&amp;lt;/ns0:MsgSchedulerTriggerSQLJobReceive&amp;gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Every node of this schema was promoted to a distinguished field so that the values can be used for decision making in the orchestration.  The first decision made is on the "IsPermissionRequired" field.&lt;/p&gt;
&lt;p&gt;&lt;img height="256" width="640" src="/images/geekswithblogs_net/LifeLongTechie/10637/r_BizTalk-SQLJob-Permission_Linking_OrchestrationStart.JPG" alt="" /&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;If permission is required (IsPermissionRequired=="YES"), BizTalk will use the configuration info in the XML trigger to format the email message.  Here is the snippet of how the email message is constructed.&lt;/p&gt;
&lt;p&gt;SQLJobEmailMessage.EmailBody &lt;br /&gt;
    = new Eai.OrchestrationHelpers.XlangCustomFormatters.RawString(&lt;br /&gt;
        MsgSchedulerTriggerSQLJobReceive.EmailMessageBodyForPermissionRequest + &lt;br /&gt;
        "&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;" +&lt;br /&gt;
        "By moving the file, you are either giving permission to the process, or disapprove of the process." +&lt;br /&gt;
        "&amp;lt;br&amp;gt;" +&lt;br /&gt;
        "This is the file to move: \"" + PermissionTriggerToBeGenereatedHere +&lt;br /&gt;
        "\"&amp;lt;br&amp;gt;" +&lt;br /&gt;
        "(You may find it easier to open the destination folder first, then navigate to the sibling folder to get to this file)" +&lt;br /&gt;
        "&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;" +&lt;br /&gt;
        "To approve, move(NOT copy) the file here: " + MsgSchedulerTriggerSQLJobReceive.PermissionRequestApprovedPath +&lt;br /&gt;
        "&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;" + &lt;br /&gt;
        "To disapprove, move(NOT copy) the file here: " + MsgSchedulerTriggerSQLJobReceive.PermissionRequestNotApprovedPath +&lt;br /&gt;
        "&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;" + &lt;br /&gt;
        "The file will be IMMEDIATELY picked up by the automated process.  This is normal.  You should receive a message soon that the file is processed." +&lt;br /&gt;
        "&amp;lt;br&amp;gt;" + &lt;br /&gt;
        "Thank you!"&lt;br /&gt;
    );&lt;br /&gt;
SQLJobSendNotification(Microsoft.XLANGs.BaseTypes.Address) = "mailto:" + MsgSchedulerTriggerSQLJobReceive.EmailRecipientToList;&lt;br /&gt;
SQLJobEmailMessage.EmailBody(Microsoft.XLANGs.BaseTypes.ContentType) = "text/html";&lt;br /&gt;
SQLJobEmailMessage(SMTP.Subject) = "Requesting Permission to Start the " + MsgSchedulerTriggerSQLJobReceive.BusinessProcessName;&lt;br /&gt;
SQLJobEmailMessage(SMTP.From) = MsgSchedulerTriggerSQLJobReceive.EmailFrom;&lt;br /&gt;
SQLJobEmailMessage(SMTP.CC) = MsgSchedulerTriggerSQLJobReceive.EmailRecipientCCList;&lt;br /&gt;
SQLJobEmailMessage(SMTP.EmailBodyFileCharset) = "UTF-8";&lt;br /&gt;
SQLJobEmailMessage(SMTP.SMTPHost) = "localhost";&lt;br /&gt;
SQLJobEmailMessage(SMTP.MessagePartsAttachments) = 2;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;After the Permission request email is sent, the next step is to generate the actual Permission Trigger file.  A correlation set is used here on SQLJobName and a newly generated GUID field.&lt;/p&gt;
&lt;p&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&amp;lt;ns0:SQLJobAuthorizationTrigger xmlns:ns0="somethingsomething"&amp;gt;&amp;lt;SQLJobName&amp;gt;Data Push&amp;lt;/SQLJobName&amp;gt;&amp;lt;CorrelationGuid&amp;gt;9f7c6b46-0e62-46a7-b3a0-b5327ab03753&amp;lt;/CorrelationGuid&amp;gt;&amp;lt;/ns0:SQLJobAuthorizationTrigger&amp;gt;&lt;/p&gt;
&lt;p&gt;The end user (the human intervention piece) will either grant permission for this process, or deny it, by moving the Permission Trigger file to either the "Approved" folder or the "NotApproved" folder.  A parallel Listen shape is waiting for either response.&lt;/p&gt;
&lt;p&gt;&lt;img height="480" width="604" src="/images/geekswithblogs_net/LifeLongTechie/10637/r_BizTalk-SQLJob-Permission_Linking_EmailPermissionRequestAndApprovalProcess.JPG" alt="" /&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;The next set of steps decide how the SQL Job is to be called, or whether it is called at all.  If permission denied, it simply sends out a notification.  If permission is granted, then the flag (IsProcessAsync) in the original Process Trigger is used.  The synchonous part is not really synchronous, but a loop timer to check the status within the calling stored procedure (for more information, check out my previous post:  http://geekswithblogs.net/LifeLongTechie/archive/2010/11/01/execute-sql-job-synchronously-for-biztalk-via-a-stored-procedure.aspx)  If it's async, then the sp starts the job and BizTalk sends out an email.&lt;/p&gt;
&lt;p&gt;&lt;img height="480" width="581" src="/images/geekswithblogs_net/LifeLongTechie/10637/r_BizTalk-SQLJob-Permission_Linking_StartSQLJob.JPG" alt="" /&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;And of course, some error notification:&lt;/p&gt;
&lt;p&gt;&lt;img height="480" width="546" src="/images/geekswithblogs_net/LifeLongTechie/10637/r_BizTalk-SQLJob-Permission_Linking_ExceptionHandling.JPG" alt="" /&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Footnote: The next version of this orchestration will have an additional parallel line near the Listen shape with a Delay built in and a Loop to send out a daily reminder if no response has been received from the end user.  The synchronous part is used to gather results and execute a data clean up process so that the SQL Job can be re-tried.  There are manu possibilities here.&lt;/p&gt; &lt;img src="http://geekswithblogs.net/LifeLongTechie/aggbug/143807.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Kevin Shyr</dc:creator>
            <guid>http://geekswithblogs.net/LifeLongTechie/archive/2011/02/04/using-biztalk-to-bridge-sql-job-and-human-intervention-requesting.aspx</guid>
            <pubDate>Fri, 04 Feb 2011 21:29:09 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LifeLongTechie/comments/143807.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LifeLongTechie/archive/2011/02/04/using-biztalk-to-bridge-sql-job-and-human-intervention-requesting.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/LifeLongTechie/comments/commentRss/143807.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/LifeLongTechie/services/trackbacks/143807.aspx</trackback:ping>
        </item>
        <item>
            <title>Using SSIS to send a HTML E-Mail Message with built-in table of Counts.</title>
            <link>http://geekswithblogs.net/LifeLongTechie/archive/2011/02/02/using-ssis-to-send-a-html-e-mail-message-with-built-in.aspx</link>
            <description>&lt;p&gt;For the record, this can be just as easily done with a .NET class with a DLL call.  The two major reasons for this ending up as a SSIS package are:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;There are a lot of SQL resources in the organization for maintenance, but not as many .NET developers.&lt;/li&gt;
    &lt;li&gt;There is an existing automated process that links up SQL Jobs (more on that in the next post), and this is part of that process.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;To start, this is what the SSIS looks like:&lt;/p&gt;
&lt;p&gt;&lt;img alt="" width="250" height="480" src="/images/geekswithblogs_net/LifeLongTechie/10637/r_Using%20SSIS%20to%20send%20a%20HTML%20E-Mail%20Message%20with%20built-in%20table%20of%20Counts%20-%20SSIS%20screenshot.JPG" /&gt;&lt;/p&gt;
&lt;p&gt;The first part of the control flow is just for the override scenario.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;In the Execute SQL Task, it calls a stored procedure, which already formats the result into XML by using "&lt;span style="color: rgb(0,0,255)"&gt;FOR XML PATH&lt;/span&gt;(&lt;span style="color: rgb(255,0,0)"&gt;'Row'&lt;/span&gt;), &lt;span style="color: rgb(0,0,255)"&gt;ROOT&lt;/span&gt;(&lt;span style="color: rgb(255,0,0)"&gt;N'FieldingCounts'&lt;/span&gt;)".  The result XML string looks like this:&lt;/p&gt;
&lt;p&gt;&lt;span style="color: rgb(51,153,102)"&gt;&amp;lt;FieldingCounts&amp;gt;&lt;br /&gt;
  &amp;lt;Row&amp;gt;&lt;br /&gt;
    &amp;lt;CellId&amp;gt;M COD&amp;lt;/CellId&amp;gt;&lt;br /&gt;
    &amp;lt;Mailed&amp;gt;64&amp;lt;/Mailed&amp;gt;&lt;br /&gt;
    &amp;lt;ReMailed&amp;gt;210&amp;lt;/ReMailed&amp;gt;&lt;br /&gt;
    &amp;lt;TotalMail&amp;gt;274&amp;lt;/TotalMail&amp;gt;&lt;br /&gt;
    &amp;lt;EMailed&amp;gt;233&amp;lt;/EMailed&amp;gt;&lt;br /&gt;
    &amp;lt;TotalSent&amp;gt;297&amp;lt;/TotalSent&amp;gt;&lt;br /&gt;
  &amp;lt;/Row&amp;gt;&lt;br /&gt;
  &amp;lt;Row&amp;gt;&lt;br /&gt;
    &amp;lt;CellId&amp;gt;M National&amp;lt;/CellId&amp;gt;&lt;br /&gt;
    &amp;lt;Mailed&amp;gt;11&amp;lt;/Mailed&amp;gt;&lt;br /&gt;
    &amp;lt;ReMailed&amp;gt;59&amp;lt;/ReMailed&amp;gt;&lt;br /&gt;
    &amp;lt;TotalMail&amp;gt;70&amp;lt;/TotalMail&amp;gt;&lt;br /&gt;
    &amp;lt;EMailed&amp;gt;90&amp;lt;/EMailed&amp;gt;&lt;br /&gt;
    &amp;lt;TotalSent&amp;gt;101&amp;lt;/TotalSent&amp;gt;&lt;br /&gt;
  &amp;lt;/Row&amp;gt;&lt;br /&gt;
  &amp;lt;Row&amp;gt;&lt;br /&gt;
    &amp;lt;CellId&amp;gt;U COD&amp;lt;/CellId&amp;gt;&lt;br /&gt;
    &amp;lt;Mailed&amp;gt;91&amp;lt;/Mailed&amp;gt;&lt;br /&gt;
    &amp;lt;ReMailed&amp;gt;238&amp;lt;/ReMailed&amp;gt;&lt;br /&gt;
    &amp;lt;TotalMail&amp;gt;329&amp;lt;/TotalMail&amp;gt;&lt;br /&gt;
    &amp;lt;EMailed&amp;gt;291&amp;lt;/EMailed&amp;gt;&lt;br /&gt;
    &amp;lt;TotalSent&amp;gt;382&amp;lt;/TotalSent&amp;gt;&lt;br /&gt;
  &amp;lt;/Row&amp;gt;&lt;br /&gt;
  &amp;lt;Row&amp;gt;&lt;br /&gt;
    &amp;lt;CellId&amp;gt;U National&amp;lt;/CellId&amp;gt;&lt;br /&gt;
    &amp;lt;Mailed&amp;gt;63&amp;lt;/Mailed&amp;gt;&lt;br /&gt;
    &amp;lt;ReMailed&amp;gt;286&amp;lt;/ReMailed&amp;gt;&lt;br /&gt;
    &amp;lt;TotalMail&amp;gt;349&amp;lt;/TotalMail&amp;gt;&lt;br /&gt;
    &amp;lt;EMailed&amp;gt;374&amp;lt;/EMailed&amp;gt;&lt;br /&gt;
    &amp;lt;TotalSent&amp;gt;437&amp;lt;/TotalSent&amp;gt;&lt;br /&gt;
  &amp;lt;/Row&amp;gt;&lt;br /&gt;
&amp;lt;/FieldingCounts&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt; This result is saved into an internal SSIS variable with the following settings on the General tab and the Result Set tab:&lt;/p&gt;
&lt;p&gt;&lt;img alt="" width="502" height="480" src="/images/geekswithblogs_net/LifeLongTechie/10637/r_Using%20SSIS%20to%20send%20a%20HTML%20E-Mail%20Message%20with%20built-in%20table%20of%20Counts%20-%20ExecSQLTask_General.JPG" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" width="513" height="480" src="/images/geekswithblogs_net/LifeLongTechie/10637/r_Using%20SSIS%20to%20send%20a%20HTML%20E-Mail%20Message%20with%20built-in%20table%20of%20Counts%20-%20ExecSQLTask_Result%20Set.JPG" /&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Now comes the trickier part.  We need to use the XML Task to format the XML string result into an HTML table, and I used Direct input XSLT&lt;/p&gt;
&lt;p&gt;&lt;img alt="" width="502" height="480" src="/images/geekswithblogs_net/LifeLongTechie/10637/r_Using%20SSIS%20to%20send%20a%20HTML%20E-Mail%20Message%20with%20built-in%20table%20of%20Counts%20-%20XMLTask_GeneralJPG.JPG" /&gt;&lt;/p&gt;
&lt;p&gt;And here is the code of XSLT:&lt;/p&gt;
&lt;p&gt;&lt;span style="color: rgb(0,0,255)"&gt;&amp;lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&amp;gt;&lt;br /&gt;
&amp;lt;xsl:output method="html" indent="yes"/&amp;gt;&lt;br /&gt;
  &amp;lt;xsl:template match="/ROOT"&amp;gt;&lt;br /&gt;
        &amp;lt;table border="1" cellpadding="6"&amp;gt;&lt;br /&gt;
          &amp;lt;tr&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;Mailed&amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;Re-mailed&amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;Total Mail (Mailed, Re-mailed)&amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;E-mailed&amp;lt;/td&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;Total Sent (Mailed, E-mailed)&amp;lt;/td&amp;gt;&lt;br /&gt;
          &amp;lt;/tr&amp;gt;&lt;br /&gt;
          &amp;lt;xsl:for-each select="FieldingCounts/Row"&amp;gt;&lt;br /&gt;
            &amp;lt;tr&amp;gt;&lt;br /&gt;
              &amp;lt;xsl:for-each select="./*"&amp;gt;&lt;br /&gt;
                &amp;lt;td&amp;gt;&lt;br /&gt;
                  &amp;lt;xsl:value-of select="." /&amp;gt;&lt;br /&gt;
                &amp;lt;/td&amp;gt;&lt;br /&gt;
              &amp;lt;/xsl:for-each&amp;gt;&lt;br /&gt;
            &amp;lt;/tr&amp;gt;&lt;br /&gt;
          &amp;lt;/xsl:for-each&amp;gt;&lt;br /&gt;
        &amp;lt;/table&amp;gt;&lt;br /&gt;
  &amp;lt;/xsl:template&amp;gt;&lt;br /&gt;
&amp;lt;/xsl:stylesheet&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; Then a script task is used to send out an HTML email (as we are all painfully aware that SSIS Send Mail Task only sends plain text)&lt;br /&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
&lt;w:WordDocument&gt;
&lt;w:View&gt;Normal&lt;/w:View&gt;
&lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
&lt;w:TrackMoves /&gt;
&lt;w:TrackFormatting /&gt;
&lt;w:PunctuationKerning /&gt;
&lt;w:ValidateAgainstSchemas /&gt;
&lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;
&lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;
&lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;
&lt;w:DoNotPromoteQF /&gt;
&lt;w:LidThemeOther&gt;EN-US&lt;/w:LidThemeOther&gt;
&lt;w:LidThemeAsian&gt;X-NONE&lt;/w:LidThemeAsian&gt;
&lt;w:LidThemeComplexScript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;
&lt;w:Compatibility&gt;
&lt;w:BreakWrappedTables /&gt;
&lt;w:SnapToGridInCell /&gt;
&lt;w:WrapTextWithPunct /&gt;
&lt;w:UseAsianBreakRules /&gt;
&lt;w:DontGrowAutofit /&gt;
&lt;w:SplitPgBreakAndParaMark /&gt;
&lt;w:DontVertAlignCellWithSp /&gt;
&lt;w:DontBreakConstrainedForcedTables /&gt;
&lt;w:DontVertAlignInTxbx /&gt;
&lt;w:Word11KerningPairs /&gt;
&lt;w:CachedColBalance /&gt;
&lt;/w:Compatibility&gt;
&lt;w:BrowserLevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;
&lt;m:mathPr&gt;
&lt;m:mathFont m:val="Cambria Math" /&gt;
&lt;m:brkBin m:val="before" /&gt;
&lt;m:brkBinSub m:val="&amp;#45;-" /&gt;
&lt;m:smallFrac m:val="off" /&gt;
&lt;m:dispDef /&gt;
&lt;m:lMargin m:val="0" /&gt;
&lt;m:rMargin m:val="0" /&gt;
&lt;m:defJc m:val="centerGroup" /&gt;
&lt;m:wrapIndent m:val="1440" /&gt;
&lt;m:intLim m:val="subSup" /&gt;
&lt;m:naryLim m:val="undOvr" /&gt;
&lt;/m:mathPr&gt;&lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
&lt;w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267"&gt;
&lt;w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal" /&gt;
&lt;w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 1" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 2" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 3" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 4" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 5" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 6" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 7" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 8" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 9" /&gt;
&lt;w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption" /&gt;
&lt;w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title" /&gt;
&lt;w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font" /&gt;
&lt;w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle" /&gt;
&lt;w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong" /&gt;
&lt;w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis" /&gt;
&lt;w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid" /&gt;
&lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text" /&gt;
&lt;w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1" /&gt;
&lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision" /&gt;
&lt;w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph" /&gt;
&lt;w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote" /&gt;
&lt;w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis" /&gt;
&lt;w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis" /&gt;
&lt;w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference" /&gt;
&lt;w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference" /&gt;
&lt;w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title" /&gt;
&lt;w:LsdException Locked="false" Priority="37" Name="Bibliography" /&gt;
&lt;w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading" /&gt;
&lt;/w:LatentStyles&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;/p&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;using&lt;/span&gt;&lt;span style="font-size: 10pt"&gt; System;&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;using&lt;/span&gt;&lt;span style="font-size: 10pt"&gt; System.Data;&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;using&lt;/span&gt;&lt;span style="font-size: 10pt"&gt; Microsoft.SqlServer.Dts.Runtime;&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;using&lt;/span&gt;&lt;span style="font-size: 10pt"&gt; System.Windows.Forms;&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;using&lt;/span&gt;&lt;span style="font-size: 10pt"&gt; System.Net.Mail;&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;using&lt;/span&gt;&lt;span style="font-size: 10pt"&gt; System.Net;&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt; &lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;namespace&lt;/span&gt;&lt;span style="font-size: 10pt"&gt; ST_b829a2615e714bcfb55db0ce97be3901.csproj&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;    [System.AddIn.&lt;span style="color: rgb(43,145,175)"&gt;AddIn&lt;/span&gt;(&lt;span style="color: rgb(163,21,21)"&gt;"ScriptMain"&lt;/span&gt;, Version = &lt;span style="color: rgb(163,21,21)"&gt;"1.0"&lt;/span&gt;, Publisher = &lt;span style="color: rgb(163,21,21)"&gt;""&lt;/span&gt;, Description = &lt;span style="color: rgb(163,21,21)"&gt;""&lt;/span&gt;)]&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;    &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;partial&lt;/span&gt; &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;ScriptMain&lt;/span&gt; : Microsoft.SqlServer.Dts.Tasks.ScriptTask.&lt;span style="color: rgb(43,145,175)"&gt;VSTARTScriptObjectModelBase&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;    {&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt; &lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;        #region&lt;/span&gt;&lt;span style="font-size: 10pt"&gt; VSTA generated code&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;        &lt;span style="color: blue"&gt;enum&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;ScriptResults&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;        {&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;            Success = Microsoft.SqlServer.Dts.Runtime.&lt;span style="color: rgb(43,145,175)"&gt;DTSExecResult&lt;/span&gt;.Success,&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;            Failure = Microsoft.SqlServer.Dts.Runtime.&lt;span style="color: rgb(43,145,175)"&gt;DTSExecResult&lt;/span&gt;.Failure&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;        };&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;        #endregion&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt; &lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;        &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; Main()&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;        {&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;            &lt;span style="color: rgb(43,145,175)"&gt;String&lt;/span&gt; EmailMsgBody = &lt;span style="color: rgb(43,145,175)"&gt;String&lt;/span&gt;.Format(&lt;span style="color: rgb(163,21,21)"&gt;"&amp;lt;HTML&amp;gt;&amp;lt;BODY&amp;gt;&amp;lt;P&amp;gt;{0}&amp;lt;/P&amp;gt;&amp;lt;P&amp;gt;{1}&amp;lt;/P&amp;gt;&amp;lt;/BODY&amp;gt;&amp;lt;/HTML&amp;gt;"&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;                                                , Dts.Variables[&lt;span style="color: rgb(163,21,21)"&gt;"Config_SMTP_MessageSourceText"&lt;/span&gt;].Value.ToString()&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;                                                , Dts.Variables[&lt;span style="color: rgb(163,21,21)"&gt;"InternalStr_CountResultAfterXSLT"&lt;/span&gt;].Value.ToString());&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;            &lt;span style="color: rgb(43,145,175)"&gt;MailMessage&lt;/span&gt; EmailCountMsg = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;MailMessage&lt;/span&gt;(Dts.Variables[&lt;span style="color: rgb(163,21,21)"&gt;"Config_SMTP_From"&lt;/span&gt;].Value.ToString().Replace(&lt;span style="color: rgb(163,21,21)"&gt;";"&lt;/span&gt;, &lt;span style="color: rgb(163,21,21)"&gt;","&lt;/span&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;                                                        , Dts.Variables[&lt;span style="color: rgb(163,21,21)"&gt;"Config_SMTP_Success_To"&lt;/span&gt;].Value.ToString().Replace(&lt;span style="color: rgb(163,21,21)"&gt;";"&lt;/span&gt;, &lt;span style="color: rgb(163,21,21)"&gt;","&lt;/span&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;                                                        , Dts.Variables[&lt;span style="color: rgb(163,21,21)"&gt;"Config_SMTP_SubjectLinePrefix"&lt;/span&gt;].Value.ToString() + &lt;span style="color: rgb(163,21,21)"&gt;" "&lt;/span&gt; + Dts.Variables[&lt;span style="color: rgb(163,21,21)"&gt;"InternalStr_FieldingDate"&lt;/span&gt;].Value.ToString()&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;                                                        , EmailMsgBody);&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;            &lt;span style="color: green"&gt;//EmailCountMsg.From.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;            EmailCountMsg.CC.Add(Dts.Variables[&lt;span style="color: rgb(163,21,21)"&gt;"Config_SMTP_Success_CC"&lt;/span&gt;].Value.ToString().Replace(&lt;span style="color: rgb(163,21,21)"&gt;";"&lt;/span&gt;, &lt;span style="color: rgb(163,21,21)"&gt;","&lt;/span&gt;));&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;            EmailCountMsg.IsBodyHtml = &lt;span style="color: blue"&gt;true&lt;/span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt; &lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;            &lt;span style="color: rgb(43,145,175)"&gt;SmtpClient&lt;/span&gt; SMTPForCount = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;SmtpClient&lt;/span&gt;(Dts.Variables[&lt;span style="color: rgb(163,21,21)"&gt;"Config_SMTP_ServerAddress"&lt;/span&gt;].Value.ToString());&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;            SMTPForCount.Credentials = &lt;span style="color: rgb(43,145,175)"&gt;CredentialCache&lt;/span&gt;.DefaultNetworkCredentials;&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt; &lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;            SMTPForCount.Send(EmailCountMsg);&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt; &lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;            Dts.TaskResult = (&lt;span style="color: blue"&gt;int&lt;/span&gt;)&lt;span style="color: rgb(43,145,175)"&gt;ScriptResults&lt;/span&gt;.Success;&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;        }&lt;/span&gt;&lt;/div&gt;
&lt;div style="line-height: normal; margin-bottom: 0pt"&gt;&lt;span style="font-size: 10pt"&gt;    }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="line-height: 115%; font-size: 10pt"&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;Note on this code: notice the email list has Replace(";", ",").  This is only here because the list is configurable in the SQL Job Step at Set Values, which does not react well with colons as email separator, but system.Net.Mail only handles comma as email separator, hence the extra replace in the string.&lt;/p&gt;
&lt;p&gt;The result is a nicely formatted email message with count information:&lt;/p&gt;
&lt;p&gt;&lt;img alt="" width="640" height="372" src="/images/geekswithblogs_net/LifeLongTechie/10637/r_Using%20SSIS%20to%20send%20a%20HTML%20E-Mail%20Message%20with%20built-in%20table%20of%20Counts%20-%20Result%20Email.JPG" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="file:///C:/DOCUME~1/shyrkh/LOCALS~1/Temp/moz-screenshot.png" /&gt;&lt;/p&gt; &lt;img src="http://geekswithblogs.net/LifeLongTechie/aggbug/143770.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Kevin Shyr</dc:creator>
            <guid>http://geekswithblogs.net/LifeLongTechie/archive/2011/02/02/using-ssis-to-send-a-html-e-mail-message-with-built-in.aspx</guid>
            <pubDate>Wed, 02 Feb 2011 21:47:05 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LifeLongTechie/comments/143770.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LifeLongTechie/archive/2011/02/02/using-ssis-to-send-a-html-e-mail-message-with-built-in.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/LifeLongTechie/comments/commentRss/143770.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/LifeLongTechie/services/trackbacks/143770.aspx</trackback:ping>
        </item>
        <item>
            <title>Informative SSIS error message to be used in notification expression</title>
            <link>http://geekswithblogs.net/LifeLongTechie/archive/2011/01/12/informative-ssis-error-message.aspx</link>
            <description>&lt;p&gt;"The " + @[System::TaskName] + " task captured error in the " +  @[System::PackageName] + " package at " + (DT_WSTR, 50) @[System::EventHandlerStartTime] + ". The message is:&lt;br /&gt;
&lt;br /&gt;
" + @[System::ErrorDescription]&lt;/p&gt; &lt;img src="http://geekswithblogs.net/LifeLongTechie/aggbug/143454.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Kevin Shyr</dc:creator>
            <guid>http://geekswithblogs.net/LifeLongTechie/archive/2011/01/12/informative-ssis-error-message.aspx</guid>
            <pubDate>Wed, 12 Jan 2011 22:53:15 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LifeLongTechie/comments/143454.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LifeLongTechie/archive/2011/01/12/informative-ssis-error-message.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/LifeLongTechie/comments/commentRss/143454.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/LifeLongTechie/services/trackbacks/143454.aspx</trackback:ping>
        </item>
        <item>
            <title>SSIS Send Mail Task and ForceExecutionValue Error</title>
            <link>http://geekswithblogs.net/LifeLongTechie/archive/2010/12/03/ssis-send-mail-task-and-forceexecutionvalue.aspx</link>
            <description>&lt;p&gt;I tried to use the "ForcedExecutionValue" on several Send Mail Tasks and log the execution into a ExecValueVariable so that at the end of the package I can log into a table to say whether the data check is successful or not (by determine whether an email was sent out)&lt;/p&gt;
&lt;p&gt;I set up a Boolean variable that is accessible at the package level, then set up my Send Mail Task as the screenshot below with Boolean as my ForcedExecutionValueType.  When I run the package, I got the error described below.&lt;/p&gt;
&lt;p&gt;Just to make sure this is not another issue of SSIS having with Boolean type ( you also can't set variable value from xp_cmdshell of type Boolean), I used variables of types String, Int32, DateTime with the corresponding ForcedExecutionValueType.  The only way to get around this error, was to set my variable to type Object, but then when you try to get the value out later, the Object is null.&lt;/p&gt;
&lt;p&gt;I didn't spend enough time on this to see whether it's really a bug in SSIS or not, or is this just how Send Mail Task works.  Just want to log the error and will circle back on this later to narrow down the issue some more.  In the meantime, please share if you have run into the same problem.  The current workaround is to attach a script task at the end.&lt;/p&gt;
&lt;p&gt;Also, need to note 2 existing limitation:&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;Data check needs to be done serially because every check needs to be inner join to a master table.  The master table has all the data in a single XML column and hence need to be retrieved with XQuery (a fundamental design flaw that needs to be changed)&lt;/li&gt;
    &lt;li&gt;The next iteration will be to change this design into a FOR loop and pull out the checking query from a table somewhere with all the info needed for email task, but is being put to the back of the priority.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Error Message:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;Error: 0xC001F009 at CountCheckBetweenODSAndCleanSchema: The type of the value being assigned to variable "User::WasErrorEmailEverSent" differs from the current variable type. Variables may not change type during execution. Variable types are strict, except for variables of type Object.&lt;/li&gt;
    &lt;li&gt;Error: 0xC0019001 at Send Mail Task on count mismatch: The wrapper was unable to set the value of the variable specified in the ExecutionValueVariable property.&lt;br /&gt;
     &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Screenshot of my Send Mail Task setup:&lt;/p&gt;
&lt;p&gt;&lt;img height="500" width="340" alt="" src="/images/geekswithblogs_net/LifeLongTechie/10637/SSIS%20Send%20Mail%20Task%20Property%20Screenshot.JPG" /&gt;&lt;/p&gt; &lt;img src="http://geekswithblogs.net/LifeLongTechie/aggbug/142986.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Kevin Shyr</dc:creator>
            <guid>http://geekswithblogs.net/LifeLongTechie/archive/2010/12/03/ssis-send-mail-task-and-forceexecutionvalue.aspx</guid>
            <pubDate>Fri, 03 Dec 2010 17:34:41 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LifeLongTechie/comments/142986.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LifeLongTechie/archive/2010/12/03/ssis-send-mail-task-and-forceexecutionvalue.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/LifeLongTechie/comments/commentRss/142986.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/LifeLongTechie/services/trackbacks/142986.aspx</trackback:ping>
        </item>
        <item>
            <title>Execute SQL Job synchronously for BizTalk via a Stored Procedure call</title>
            <link>http://geekswithblogs.net/LifeLongTechie/archive/2010/11/01/execute-sql-job-synchronously-for-biztalk-via-a-stored-procedure.aspx</link>
            <description>&lt;p&gt;The async one was very easy to do.  However, in the process automation task I was given, there was a need to execute SQL Job and waiting for the execution result.  I couldn't find anything on the web to do what I wanted, so I make the following stored procedure.&lt;/p&gt;
&lt;p&gt;In addition, this stored procedure is quasi-synchronous.  I start the job and then check the status.  You can change the timing of the status check, but for the example below, it is "synchronous within 30 seconds."  I wish there is a better way to do this, but at my current knowledge base I only came up with this:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;CREATE PROCEDURE [SQLJobExecSyncByName]&lt;br /&gt;
    @SQLJobName AS [varchar](128),&lt;br /&gt;
    @SQLJobStepName AS [varchar](128),&lt;br /&gt;
    @MinutesToWait AS [int],&lt;br /&gt;
    @JobExecStatus AS [bit] output&lt;br /&gt;
AS&lt;br /&gt;
BEGIN&lt;br /&gt;
    -- SET NOCOUNT ON added to prevent extra result sets from&lt;br /&gt;
    -- interfering with SELECT statements.&lt;br /&gt;
    SET NOCOUNT ON;&lt;br /&gt;
    &lt;br /&gt;
    DECLARE @JobStartDateTime AS DATETIME&lt;br /&gt;
    DECLARE @SPQuitDateTime AS DATETIME&lt;br /&gt;
    DECLARE @JobStartDateAsString AS VARCHAR(8)&lt;br /&gt;
    DECLARE @JobStartTimeAsString AS VARCHAR(6)&lt;br /&gt;
    DECLARE @SPOutcome AS BIT&lt;br /&gt;
    SET @JobStartDateTime = DATEADD(mi, -1, GETDATE())&lt;br /&gt;
    SET @SPQuitDateTime = DATEADD(mi, @MinutesToWait, GETDATE())&lt;br /&gt;
    SET @SPOutcome = 0&lt;br /&gt;
    SELECT @JobStartDateAsString = CONVERT(VARCHAR(8), @JobStartDateTime, 112)&lt;br /&gt;
    SELECT @JobStartTimeAsString = REPLACE(CONVERT(VARCHAR(8), @JobStartDateTime, 108), ':', '')&lt;br /&gt;
&lt;br /&gt;
    -- Create a temp table to store result&lt;br /&gt;
    CREATE TABLE #Result_sp_help_jobhistory&lt;br /&gt;
    (&lt;br /&gt;
        instance_id [int]&lt;br /&gt;
        , job_id [uniqueidentifier]&lt;br /&gt;
        , job_name [sysname]&lt;br /&gt;
        , step_id [int]&lt;br /&gt;
        , step_name [sysname]&lt;br /&gt;
        , sql_message_id [int]&lt;br /&gt;
        , sql_severity [int]&lt;br /&gt;
        , [message] [nvarchar](1024)&lt;br /&gt;
        , run_status [int]&lt;br /&gt;
        , run_date [int]&lt;br /&gt;
        , run_time [int]&lt;br /&gt;
        , run_duration [int]&lt;br /&gt;
        , operator_emailed [nvarchar](20)&lt;br /&gt;
        , operator_netsent [nvarchar](20)&lt;br /&gt;
        , operator_paged [nvarchar](20)&lt;br /&gt;
        , retries_attempted [int]&lt;br /&gt;
        , [server] [nvarchar](30)&lt;br /&gt;
    )&lt;br /&gt;
&lt;br /&gt;
    -- Start the job @SQLJobName at step @SQLJobStepName&lt;br /&gt;
    EXEC msdb.dbo.sp_start_job &lt;br /&gt;
        @job_name = @SQLJobName, &lt;br /&gt;
        @server_name = @@SERVERNAME,&lt;br /&gt;
        @step_name = @SQLJobStepName;&lt;br /&gt;
    &lt;br /&gt;
    WHILE (GETDATE() &amp;lt; @SPQuitDateTime) -- not time to quit yet&lt;br /&gt;
    BEGIN&lt;br /&gt;
        -- Check to see if the job has finished successfully&lt;br /&gt;
        INSERT INTO #Result_sp_help_jobhistory&lt;br /&gt;
            (instance_id&lt;br /&gt;
                , job_id&lt;br /&gt;
                , job_name&lt;br /&gt;
                , step_id&lt;br /&gt;
                , step_name&lt;br /&gt;
                , sql_message_id&lt;br /&gt;
                , sql_severity&lt;br /&gt;
                , [message]&lt;br /&gt;
                , run_status&lt;br /&gt;
                , run_date&lt;br /&gt;
                , run_time&lt;br /&gt;
                , run_duration&lt;br /&gt;
                , operator_emailed&lt;br /&gt;
                , operator_netsent&lt;br /&gt;
                , operator_paged&lt;br /&gt;
                , retries_attempted&lt;br /&gt;
                , [server]&lt;br /&gt;
            )&lt;br /&gt;
        EXEC msdb.dbo.sp_help_jobhistory&lt;br /&gt;
            @job_name = @SQLJobName, &lt;br /&gt;
            @start_run_date = @JobStartDateAsString, &lt;br /&gt;
            @start_run_time = @JobStartTimeAsString,&lt;br /&gt;
            --@run_status = 1, -- Success&lt;br /&gt;
            @mode = 'FULL'&lt;br /&gt;
&lt;br /&gt;
        IF(EXISTS(SELECT * &lt;br /&gt;
                    FROM #Result_sp_help_jobhistory&lt;br /&gt;
                    WHERE job_name = @SQLJobName&lt;br /&gt;
                        AND step_name = '(Job outcome)'&lt;br /&gt;
                        AND run_status = 1&lt;br /&gt;
                        AND @JobStartDateTime &amp;lt; CONVERT(DATETIME, CONVERT(VARCHAR(8), run_date) + ' ' + SUBSTRING(CONVERT(VARCHAR(6), run_time), 1, 2) + ':' + SUBSTRING(CONVERT(VARCHAR(6), run_time), 3, 2) + ':' + SUBSTRING(CONVERT(VARCHAR(6), run_time), 5, 2), 112)&lt;br /&gt;
                )&lt;br /&gt;
            )&lt;br /&gt;
        BEGIN&lt;br /&gt;
            -- The job has succceeded at least once after it was called&lt;br /&gt;
            SET @SPOutcome = 1&lt;br /&gt;
            GOTO FinishingStoredProcedureCall;&lt;br /&gt;
        END&lt;br /&gt;
        &lt;br /&gt;
        IF(EXISTS(SELECT * &lt;br /&gt;
                    FROM #Result_sp_help_jobhistory&lt;br /&gt;
                    WHERE job_name = @SQLJobName&lt;br /&gt;
                        AND step_name = '(Job outcome)'&lt;br /&gt;
                        AND run_status = 0&lt;br /&gt;
                        AND @JobStartDateTime &amp;lt; CONVERT(DATETIME, CONVERT(VARCHAR(8), run_date) + ' ' + SUBSTRING(CONVERT(VARCHAR(6), run_time), 1, 2) + ':' + SUBSTRING(CONVERT(VARCHAR(6), run_time), 3, 2) + ':' + SUBSTRING(CONVERT(VARCHAR(6), run_time), 5, 2), 112)&lt;br /&gt;
                )&lt;br /&gt;
            )&lt;br /&gt;
        BEGIN&lt;br /&gt;
            -- The job has failed after it was called&lt;br /&gt;
            GOTO FinishingStoredProcedureCall;&lt;br /&gt;
        END&lt;br /&gt;
        &lt;br /&gt;
        -- Clean up for the next run&lt;br /&gt;
        TRUNCATE TABLE #Result_sp_help_jobhistory&lt;br /&gt;
        &lt;br /&gt;
        -- check every 30 seconds&lt;br /&gt;
        WAITFOR DELAY '00:00:30';&lt;br /&gt;
    END&lt;br /&gt;
    &lt;br /&gt;
    FinishingStoredProcedureCall:&lt;br /&gt;
        SET @JobExecStatus = @SPOutcome&lt;br /&gt;
        DROP TABLE #Result_sp_help_jobhistory;&lt;br /&gt;
    &lt;br /&gt;
END&lt;br /&gt;
&lt;br /&gt;
 &lt;/p&gt;
&lt;p&gt;This SP was made to return an output parameter as result as to maximize reusability of the logic.  In order to use this from BizTalk, it was hooked into the following SP:&lt;/p&gt;
&lt;p&gt;CREATE PROCEDURE [SQLJobExecSyncByNameForBizTalk]&lt;br /&gt;
    @SQLJobName AS [varchar](128),&lt;br /&gt;
    @SQLJobStepName AS [varchar](128),&lt;br /&gt;
    @MinutesToWait AS [int]&lt;br /&gt;
AS&lt;br /&gt;
BEGIN&lt;br /&gt;
    -- SET NOCOUNT ON added to prevent extra result sets from&lt;br /&gt;
    -- interfering with SELECT statements.&lt;br /&gt;
    SET NOCOUNT ON;&lt;br /&gt;
    &lt;br /&gt;
    DECLARE @JobExecStatus AS BIT&lt;br /&gt;
&lt;br /&gt;
    EXEC [ODS].[SQLJobExecSyncByName] &lt;br /&gt;
        @SQLJobName = @SQLJobName,&lt;br /&gt;
        @SQLJobStepName = @SQLJobStepName,&lt;br /&gt;
        @MinutesToWait = @MinutesToWait,&lt;br /&gt;
        @JobExecStatus = @JobExecStatus OUTPUT;&lt;br /&gt;
        &lt;br /&gt;
    SELECT CONVERT(VARCHAR(8), @JobExecStatus)&lt;br /&gt;
         FOR XML PATH(N''), ROOT(N'JobExecStatus');&lt;br /&gt;
        &lt;br /&gt;
END&lt;/p&gt; &lt;img src="http://geekswithblogs.net/LifeLongTechie/aggbug/142555.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Kevin Shyr</dc:creator>
            <guid>http://geekswithblogs.net/LifeLongTechie/archive/2010/11/01/execute-sql-job-synchronously-for-biztalk-via-a-stored-procedure.aspx</guid>
            <pubDate>Mon, 01 Nov 2010 20:18:30 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LifeLongTechie/comments/142555.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LifeLongTechie/archive/2010/11/01/execute-sql-job-synchronously-for-biztalk-via-a-stored-procedure.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/LifeLongTechie/comments/commentRss/142555.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/LifeLongTechie/services/trackbacks/142555.aspx</trackback:ping>
        </item>
    </channel>
</rss>
