SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Variable row lengths
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

benking9987
Posting Yak Master

121 Posts

Posted - 09/07/2012 :  13:28:38  Show Profile  Reply with Quote
I have an Import/Export routine that grabs a .txt file and pulls it into a buffer table in my SQLServer 2005. The .txt file is fairly straight forward except for one anomaly.

This is an order file given to me from a large e-commerce company, so to begin...there is nothing I can do to change the way I'm getting the data. A specific type of record that they send through on the file has the row delimiter (CR/LF) at the end of column #65 but the rest of the file goes to 73 columns. So it looks like this:

REGULAR ROW
Field1<tab>Field2<tab>Field3<tab>...Field73<CR/LF>

ANOMALY ROW
Field1<tab>Field2<tab>Field3<tab>...Field65<CR/LF>

Because there are not column delimiters<tab> to fill out the rest of the rows, the data in the row immediately following the anomaly row gets messed up.

Can anyone think of a way to get the data to flow in smoothly, so the Import/Export setup knows to always start a new row at the CR/LF. In the Source data setup, {CR}{LF} is CLEARLY chosen as the Row delimiter.

Any help is much appreciated.

Thanks in advance.

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 09/09/2012 :  12:57:51  Show Profile  Reply with Quote
i think best thing would be to use ssis package and parse data file using script task and insert the missing tabs in cases column dont exists (anamoly rows). then giving it to normal data flow task should run export smoothly

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

benking9987
Posting Yak Master

121 Posts

Posted - 09/10/2012 :  16:24:10  Show Profile  Reply with Quote
Thanks visakh16. I think I'm officially out of my league on your suggestion as I have no experience writing a custom script to parse the data. I do know a pretty good programmer/developer locally and I'll see if he can help me get in the right direction.

Thanks
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000