<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlblogcasts.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>greenmtnsun : insert different data from one file into seperate tables in a database</title><link>http://sqlblogcasts.com/blogs/greenmtnsun/archive/tags/insert+different+data+from+one+file+into+seperate+tables+in+a+database/default.aspx</link><description>Tags: insert different data from one file into seperate tables in a database</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20917.1142)</generator><item><title>SSIS conditional Split</title><link>http://sqlblogcasts.com/blogs/greenmtnsun/archive/2007/09/24/ssis-conditional-split.aspx</link><pubDate>Mon, 24 Sep 2007 21:20:00 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:2564</guid><dc:creator>greenmtnsun</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/greenmtnsun/rsscomments.aspx?PostID=2564</wfw:commentRss><comments>http://sqlblogcasts.com/blogs/greenmtnsun/archive/2007/09/24/ssis-conditional-split.aspx#comments</comments><description>&lt;p&gt;I needed to figure out how to get SSIS to consume a file that had lines of data with attributes of both "apples" and "oranges".&amp;nbsp; No matter where I looked online, it was as if SSIS could not take in a file that had different types of data on each line and then throw that data into a database.&amp;nbsp; The situation looked bleak, until I found a little item in my toolbox inside a data flow called "Conditional Split". &lt;br&gt;&lt;br&gt;Conditional Split is almost like a little tool that makes your flat file like XML in that you can send data from the source to many tables.&amp;nbsp; When you consume an XML file in SSIS, you could have many tables that could flow from that source.&amp;nbsp; The same is true when you use Conditional Split; you tell SSIS when a line is a different row type and BAMM, you are on your way to multiple tables of data getting inserted into your database.&lt;/p&gt;&lt;p&gt;For me, the trick to all of this wasn't in how I accomplished this, but rather how to know what types of tools you need to use in SSIS to do what you need to do.&lt;/p&gt;&lt;p&gt; I have my Data Flow task.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;  Inside that I have my flat file Source.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;  That component points to a "Conditional Split" component.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Inside of that component I simply created multiple conditions that meant that if a line started like X, then output that line to a separate flow into a table.&amp;nbsp; In my case, I said substring(Field_name,1,5)=="Batch" and called that Output Name "Batch_Details" table. I created other lines to, like substring(Field_name,1,3)=="Act" with an Output name of "Account Details".&amp;nbsp; You can create as many types of output lines as you might need, although I don't know what the technical limit is, I only needed 10.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;  That component then pointed to a derived columns component.&amp;nbsp; In my case, I had a fixed length file so I created a bunch of columns that were created by substring commands.&amp;nbsp; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; That component pointed to a OLE DB Destination.&lt;br&gt;&lt;br&gt;That was it.&amp;nbsp; It turned out to be pretty simple; if I could only figure out how SSIS could perform the actions.&amp;nbsp; I remain disappointed that there weren't many posts, FAQ's or much of anything out on the net to help reveal how to perform these actions.&lt;br&gt;&lt;/p&gt;&lt;p&gt;Keith&lt;br&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=2564" width="1" height="1"&gt;</description><enclosure url="http://sqlblogcasts.com/blogs/greenmtnsun/attachment/2564.ashx" length="136956" type="image/jpeg" /><category domain="http://sqlblogcasts.com/blogs/greenmtnsun/archive/tags/SSIS/default.aspx">SSIS</category><category domain="http://sqlblogcasts.com/blogs/greenmtnsun/archive/tags/data+flow/default.aspx">data flow</category><category domain="http://sqlblogcasts.com/blogs/greenmtnsun/archive/tags/conditional+processing/default.aspx">conditional processing</category><category domain="http://sqlblogcasts.com/blogs/greenmtnsun/archive/tags/Conditional+Split/default.aspx">Conditional Split</category><category domain="http://sqlblogcasts.com/blogs/greenmtnsun/archive/tags/insert+different+data+from+one+file+into+seperate+tables+in+a+database/default.aspx">insert different data from one file into seperate tables in a database</category></item></channel></rss>