<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.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>You had me at "Hello World" : SSIS</title><link>http://blogs.msdn.com/helloworld/archive/tags/SSIS/default.aspx</link><description>Tags: SSIS</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>How to Find Out Which Column Caused SSIS to Fail?</title><link>http://blogs.msdn.com/helloworld/archive/2008/08/01/how-to-find-out-which-column-caused-ssis-to-fail.aspx</link><pubDate>Fri, 01 Aug 2008 15:50:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8792905</guid><dc:creator>HelloWorld</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/helloworld/comments/8792905.aspx</comments><wfw:commentRss>http://blogs.msdn.com/helloworld/commentrss.aspx?PostID=8792905</wfw:commentRss><description>&lt;P&gt;In my previous &lt;A href="http://blogs.msdn.com/helloworld/archive/2008/07/25/how-to-decipher-understand-ssis-error-code.aspx" mce_href="http://blogs.msdn.com/helloworld/archive/2008/07/25/how-to-decipher-understand-ssis-error-code.aspx"&gt;post&lt;/A&gt;, I explained how you can find out the error description for the error id that is returned by SSIS.&lt;/P&gt;
&lt;P&gt;Of course, that information is only half helpful, debugging the issue also involve knowing which column caused that error. The Error Column returns an integer value which is also a little bit confusing, how can I know which column is represented by this integer value?&lt;/P&gt;
&lt;P&gt;The Error Column corresponds to the value of the lineageId attribute inside the SSIS package. As you already know, SSIS package is an xml file. The node that contains lineageId attribute may or may not has a name attribute. The value of the name attribute is the column name.&lt;/P&gt;
&lt;P&gt;To query the lineage id and the column id, you can use this code using LINQ.&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;private &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Dictionary&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;long&lt;/SPAN&gt;, &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;&amp;gt; GetLineageIdAndColumnMapping(&lt;SPAN style="COLOR: blue"&gt;string &lt;/SPAN&gt;SSISFilename)
{
    &lt;SPAN style="COLOR: #2b91af"&gt;XDocument &lt;/SPAN&gt;xdoc = &lt;SPAN style="COLOR: #2b91af"&gt;XDocument&lt;/SPAN&gt;.Load(SSISFilename);
    &lt;SPAN style="COLOR: #2b91af"&gt;Dictionary&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;long&lt;/SPAN&gt;, &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;&amp;gt; LineageColumn = &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Dictionary&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;long&lt;/SPAN&gt;, &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;&amp;gt;();

    &lt;SPAN style="COLOR: blue"&gt;var &lt;/SPAN&gt;LineageNodes = &lt;SPAN style="COLOR: blue"&gt;from &lt;/SPAN&gt;Nodes &lt;SPAN style="COLOR: blue"&gt;in &lt;/SPAN&gt;xdoc.Descendants()
                       &lt;SPAN style="COLOR: blue"&gt;where &lt;/SPAN&gt;Nodes.Attribute(&lt;SPAN style="COLOR: #a31515"&gt;"lineageId"&lt;/SPAN&gt;) != &lt;SPAN style="COLOR: blue"&gt;null &lt;/SPAN&gt;&amp;amp;&amp;amp;
                             Nodes.Attribute(&lt;SPAN style="COLOR: #a31515"&gt;"lineageId"&lt;/SPAN&gt;).Value != &lt;SPAN style="COLOR: #2b91af"&gt;String&lt;/SPAN&gt;.Empty &amp;amp;&amp;amp;
                             Nodes.Attribute(&lt;SPAN style="COLOR: #a31515"&gt;"name"&lt;/SPAN&gt;) != &lt;SPAN style="COLOR: blue"&gt;null &lt;/SPAN&gt;&amp;amp;&amp;amp;
                             Nodes.Attribute(&lt;SPAN style="COLOR: #a31515"&gt;"name"&lt;/SPAN&gt;).Value != &lt;SPAN style="COLOR: #2b91af"&gt;String&lt;/SPAN&gt;.Empty
                       &lt;SPAN style="COLOR: blue"&gt;select new
                       &lt;/SPAN&gt;{
                           LineageId = &lt;SPAN style="COLOR: #2b91af"&gt;Convert&lt;/SPAN&gt;.ToInt64(Nodes.Attribute(&lt;SPAN style="COLOR: #a31515"&gt;"lineageId"&lt;/SPAN&gt;).Value),
                           ColumnName = Nodes.Attribute(&lt;SPAN style="COLOR: #a31515"&gt;"name"&lt;/SPAN&gt;).Value
                       };

    &lt;SPAN style="COLOR: blue"&gt;foreach &lt;/SPAN&gt;(&lt;SPAN style="COLOR: blue"&gt;var &lt;/SPAN&gt;Item &lt;SPAN style="COLOR: blue"&gt;in &lt;/SPAN&gt;LineageNodes)
        LineageColumn.Add(Item.LineageId, Item.ColumnName);

    &lt;SPAN style="COLOR: blue"&gt;return &lt;/SPAN&gt;LineageColumn;
}&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;If you are not using .Net framework 3.5, then this XPath code will also do the trick.&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;private &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Dictionary&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;long&lt;/SPAN&gt;, &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;&amp;gt; GetLineageIdAndColumnMapping(&lt;SPAN style="COLOR: blue"&gt;string &lt;/SPAN&gt;SSISFilename)
{
    &lt;SPAN style="COLOR: #2b91af"&gt;XmlDocument &lt;/SPAN&gt;doc = &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;XmlDocument&lt;/SPAN&gt;();
    doc.Load(SSISFilename);
    &lt;SPAN style="COLOR: #2b91af"&gt;Dictionary&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;long&lt;/SPAN&gt;, &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;&amp;gt; LineageColumn = &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Dictionary&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;long&lt;/SPAN&gt;, &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;&amp;gt;();

    &lt;SPAN style="COLOR: blue"&gt;foreach &lt;/SPAN&gt;(&lt;SPAN style="COLOR: #2b91af"&gt;XmlNode &lt;/SPAN&gt;node &lt;SPAN style="COLOR: blue"&gt;in &lt;/SPAN&gt;doc.SelectNodes(&lt;SPAN style="COLOR: #a31515"&gt;"//*[@lineageId != '' and @name != '']"&lt;/SPAN&gt;))
        LineageColumn.Add(&lt;SPAN style="COLOR: #2b91af"&gt;Convert&lt;/SPAN&gt;.ToInt64(node.Attributes[&lt;SPAN style="COLOR: #a31515"&gt;"lineageId"&lt;/SPAN&gt;].Value),
                          node.Attributes[&lt;SPAN style="COLOR: #a31515"&gt;"name"&lt;/SPAN&gt;].Value);
    

    &lt;SPAN style="COLOR: blue"&gt;return &lt;/SPAN&gt;LineageColumn;
}&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;That code above, will give a dictionary of lineage id and the actual column name, now using the value from the ErrorColumn field, you can lookup the actual column name.&lt;/P&gt;
&lt;P&gt;Someone might say, the XPath is shorter, it is better. Well, there are more than one metrics to evaluate a piece of code. LINQ enables code reviewer who are not familiar with XPath to quickly review the code, understand what is going on, and comment on it.&lt;/P&gt;
&lt;P&gt;The beauty of LINQ, your knowledge is almost transferable among different data sources.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8792905" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/helloworld/archive/tags/LINQ/default.aspx">LINQ</category><category domain="http://blogs.msdn.com/helloworld/archive/tags/How+to/default.aspx">How to</category><category domain="http://blogs.msdn.com/helloworld/archive/tags/Database/default.aspx">Database</category><category domain="http://blogs.msdn.com/helloworld/archive/tags/SSIS/default.aspx">SSIS</category></item><item><title>How to Decipher/Understand SSIS Error Code?</title><link>http://blogs.msdn.com/helloworld/archive/2008/07/25/how-to-decipher-understand-ssis-error-code.aspx</link><pubDate>Sat, 26 Jul 2008 00:22:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8773062</guid><dc:creator>HelloWorld</dc:creator><slash:comments>11</slash:comments><comments>http://blogs.msdn.com/helloworld/comments/8773062.aspx</comments><wfw:commentRss>http://blogs.msdn.com/helloworld/commentrss.aspx?PostID=8773062</wfw:commentRss><description>&lt;p&gt;If you have worked with SSIS, you may have been doing something like this, in case of errors, you saved the error code and the error column to a text file or some other media.&lt;/p&gt;  &lt;p&gt;If you get the error within the IDE, that is cool, as you can get more readable information, but if you run the SSIS package in production environment, you does not get that readable information, only a numeric value.&lt;/p&gt;  &lt;p&gt;Now you need to know what caused the error, so you read the error code. Unfortunately, the error code is not that clear.&lt;/p&gt;  &lt;p&gt;To understand what is the meaning of the error code, you need these two things, Calculator (calc.exe), and dtsmsg.h file. dtsmsg.h by default is located under “C:\Program Files\Microsoft SQL Server\90\SDK\Include”. If you install SQL Server, you should have this file.&lt;/p&gt;  &lt;p&gt;Let says, you get error –1071607689. To see what is the actual error:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;First open Calculator and switch to Scientific mode, and make sure the Decimal radio button is selected. Then type that number.     &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/helloworld/WindowsLiveWriter/HowtoDecipherUnderstandSSISErrorCode_CA32/image_2.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="284" alt="image" src="http://blogs.msdn.com/blogfiles/helloworld/WindowsLiveWriter/HowtoDecipherUnderstandSSISErrorCode_CA32/image_thumb.png" width="432" border="0" /&gt;&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Click the Hex radio button, now you get a hex number, it is prefixed with eight Fs.     &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/helloworld/WindowsLiveWriter/HowtoDecipherUnderstandSSISErrorCode_CA32/image_4.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="286" alt="image" src="http://blogs.msdn.com/blogfiles/helloworld/WindowsLiveWriter/HowtoDecipherUnderstandSSISErrorCode_CA32/image_thumb_1.png" width="435" border="0" /&gt;&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Copy the text, excluding the first eight Fs. In that example above, it is C0209077.&lt;/li&gt;    &lt;li&gt;Search that code inside dtsmsg.h. Now you get the constant and the description. That example above, the constant is DTS_E_OLEDBDESTINATIONADAPTERSTATIC_CANTCONVERTVALUE, and the description is ‘The data value cannot be converted for reasons other than sign mismatch or data overflow.’&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;One more error code that I found were –1071607675, using that method above, you can see that that code means there was data truncation.&lt;/p&gt;  &lt;p&gt;Hopefully this will help you to figure out what was wrong with the SSIS package.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8773062" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/helloworld/archive/tags/How+to/default.aspx">How to</category><category domain="http://blogs.msdn.com/helloworld/archive/tags/Database/default.aspx">Database</category><category domain="http://blogs.msdn.com/helloworld/archive/tags/SSIS/default.aspx">SSIS</category></item></channel></rss>