<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlblog.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Search results matching tags 'SSIS', 'flat file source', and 'nugget'</title><link>http://sqlblog.com/search/SearchResults.aspx?o=DateDescending&amp;tag=SSIS,flat+file+source,nugget&amp;orTags=0</link><description>Search results matching tags 'SSIS', 'flat file source', and 'nugget'</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>FileNameColumnName property, Flat File Source Adapter : SSIS Nugget</title><link>http://sqlblog.com/blogs/jamie_thomson/archive/2010/03/31/filenamecolumnname-property-flat-file-source-adapter-ssis-nugget.aspx</link><pubDate>Wed, 31 Mar 2010 21:51:11 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:23930</guid><dc:creator>jamiet</dc:creator><description>&lt;p&gt; I saw a question on MSDN’s SSIS forum the other day that went something like this:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;I’m loading data into a table from a flat file but I want to be able to store the name of that file as well. Is there a way of doing that?&lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;I don’t want to come across as disrespecting those who took the time to reply but there was a few answers along the lines of “loop over the files using a For Each, store the file name in a variable yadda yadda yadda” when in fact there is a much much simpler way of accomplishing this; it just happens to be a little hidden away as I shall now explain!&lt;/p&gt;  &lt;p&gt;The &lt;a href="http://msdn.microsoft.com/en-us/library/ms139941.aspx" target="_blank"&gt;Flat File Source Adapter&lt;/a&gt; has a property called &lt;a href="http://msdn.microsoft.com/en-us/library/ms135923.aspx#flatfile" target="_blank"&gt;FileNameColumnName&lt;/a&gt;&lt;font face="Courier New"&gt;&lt;/font&gt; which for some reason it isn’t exposed through the Flat File Source editor, it &lt;em&gt;is&lt;/em&gt; however exposed via the Advanced Properties:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/cid_image001_png01CAD0EF_7160518C.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="flat file source adapter advanced properties" border="0" alt="flat file source adapter advanced properties" src="http://sqlblog.com/blogs/jamie_thomson/cid_image001_png01CAD0EF_thumb_04052577.png" width="512" height="523" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;You’ll see in the screenshot above that I have set&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;FileNameColumnName=“Filename”&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;(it doesn’t matter what name you use, anything except a non-zero string will work). What this will do is create a new column in our dataflow called “Filename” that contains, unsurprisingly, the name of the file from which the row was sourced. All very simple. This is particularly useful if you are extracting data from multiple files using the &lt;a href="http://msdn.microsoft.com/en-us/library/ms137830.aspx" target="_blank"&gt;MultiFlatFile Connection Manager&lt;/a&gt; as it allows you to differentiate between data from each of the files as you can see in the following screenshot:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_0BECA20C.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="filename data viewer" border="0" alt="filename data viewer" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_56FF9CCE.png" width="357" height="523" /&gt;&lt;/a&gt; &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;So there you have it, the &lt;font face="Courier New"&gt;FileNameColumnName &lt;/font&gt;property; a little known secret of SSIS. I hope it proves to be useful to someone out there.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://twitter.com/jamiet" target="_blank"&gt;@Jamiet&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Parsing flat files using SSIS : SSIS Nugget</title><link>http://sqlblog.com/blogs/jamie_thomson/archive/2010/03/24/parsing-flat-files-using-ssis-ssis-nugget.aspx</link><pubDate>Wed, 24 Mar 2010 23:11:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:23716</guid><dc:creator>jamiet</dc:creator><description>&lt;P&gt;Often when using SQL Server Integration Services (SSIS) you will find there is more than one way of accomplishing a task and that the most obvious method of doing so might not be the optimal one. In the video below I demonstrate this by way of an experiment using SSIS’s Flat File Source component; I show different ways that you can pull data from a flat file into the SSIS dataflow and also how the nature of the data itself can influence your choice as to how this task should be accomplished.&lt;/P&gt;
&lt;OBJECT&gt;
&lt;embed style="WIDTH:600px;HEIGHT:450px;" src="http://vimeo.com/moogaloop.swf?clip_id=10417434&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00ADEF&amp;amp;fullscreen=1" allowfullscreen="true"&gt;&lt;/embed&gt;&lt;/OBJECT&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;EM&gt;If you are having trouble viewing the video in your blog reader then head to&amp;nbsp;&lt;/EM&gt;&lt;A href="http://sqlblog.com/blogs/jamie_thomson/archive/2010/03/25/parsing-flat-files-using-ssis-ssis-nugget.aspx"&gt;&lt;EM&gt;http://sqlblog.com/blogs/jamie_thomson/archive/2010/03/25/parsing-flat-files-using-ssis-ssis-nugget.aspx&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;&amp;nbsp;to see it as it is hosted on my blog!&lt;/EM&gt;&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The main point I want to get across from this video is that a little bit of creative thinking when building your dataflows can sometimes be very beneficial for performance; quite often building a solution that isn’t the most obvious might actually turn out to be the best one.&lt;/P&gt;
&lt;P&gt;You’ll notice, if you have watched the video, that my editing skills weren’t quite up to snuff and I cut off the final few words however all I was saying was that if you have any feedback on this video then I would love to hear it either via email or preferably the comments section below. I hope this turns out to be useful to some of you.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://twitter.com/jamiet" target=_blank&gt;@Jamiet&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;P.S. Incidentally the parsing that we do using SSIS expressions in the video would be much easier if we had a TOKENISE function in SSIS’s expression language and I have asked for the introduction of such a function on Connect at &lt;A href="https://connect.microsoft.com/SQLServer/feedback/details/543945/ssis-token-string-tokeniser-string-occurence-function" target=_blank&gt;[SSIS] TOKEN(string, tokeniser_string, occurence) function&lt;/A&gt;. Feel free to go and vote that up if you think this feature would be useful!&lt;/P&gt;</description></item></channel></rss>