SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SSIS - Import flat file with trailer


SSIS - Import flat file with trailer

Author
Message
apache626
apache626
SSC Rookie
SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)

Group: General Forum Members
Points: 30 Visits: 67
I have a flat file with trailers that the total the amounts in certain columns. I need to import the trailer into a different table. How can I split the data so that I can put the trailer data into a different table. Here is the sample data below:

1002A Mickey Mouse 500.00 25.00 ACMECORP 1000.00
1002B Duck Donald 125.00 15.00 ACMECORP 2500.00
1002T Doe Jane 750.00 20.00 ACMECORP 2300.00
1002 1375.00 60.00 5800.00 2010
1003 6740.56 75.00 7800.23 2011
rhythmk
rhythmk
SSC Eights!
SSC Eights! (912 reputation)SSC Eights! (912 reputation)SSC Eights! (912 reputation)SSC Eights! (912 reputation)SSC Eights! (912 reputation)SSC Eights! (912 reputation)SSC Eights! (912 reputation)SSC Eights! (912 reputation)

Group: General Forum Members
Points: 912 Visits: 1078
apache626 (9/27/2012)
I have a flat file with trailers that the total the amounts in certain columns. I need to import the trailer into a different table. How can I split the data so that I can put the trailer data into a different table. Here is the sample data below:

1002A Mickey Mouse 500.00 25.00 ACMECORP 1000.00
1002B Duck Donald 125.00 15.00 ACMECORP 2500.00
1002T Doe Jane 750.00 20.00 ACMECORP 2300.00
1002 1375.00 60.00 5800.00 2010
1003 6740.56 75.00 7800.23 2011


Try using conditional split.

However please provide more input for more assistance e.g.
1. What is the trailer part in above example ?
2. Is there any fixed pattern or length for this ?
3. Logic behind trailer generation in more detail.

--rhythmk
------------------------------------------------------------------
To post your question use below link

http://www.sqlservercentral.com/articles/Best+Practices/61537/
:-)
Tim Mitchell
Tim Mitchell
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1801 Visits: 2988
Agreed that the simplest way is to use a conditional split if possible. However, if your footer record(s) is not structured like your other rows, it's possible that you could get an error during processing, or worse, the footer row(s) would actually be processed with your data. In cases such as that, you may have to use a couple of derived column transformations to handle the data, or possibly a script component to programmatically filter out those rows.

This is one area where SQL Server 2012 offers a distinct advantage - it won't blow up if you have files with dissimilarly structured rows. If you're on 2012, the conditional split design pattern for filtering header/footer rows is usually your best bet.

hth,
Tim



Tim Mitchell, Microsoft Data Platform MVP
Data Warehouse and ETL Consultant
TimMitchell.net | @Tim_Mitchell | Tyleris.com
ETL Best Practices


Daniel Bowlin
Daniel Bowlin
SSCarpal Tunnel
SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)

Group: General Forum Members
Points: 4110 Visits: 2629
This might be useful.

http://www.bidn.com/articles/integration-services/234/handling-complex-text-files-in-ssis
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search