May 4, 2007 at 7:31 am
So, I have a file, which is delimited with either a | or a tab character, but I can't figure out how to transform it properly. Where I get stuck is that the file is composed of different record types, each record is a row, but the length of the row is always different with different number of columns.
So basically I'm looking to split the file by record type, and then insert each record type rows into its own table.
Any ideas?
Thanks!
May 4, 2007 at 8:42 am
I had a similar problem recently the and best way i found to go about this is to create a staging table with two fields (record type, rest of the data). Once you have that, you can use write a sql sproc to do the parsing based on record type. Ofcourse this is the way i went about it, but my file structure was not that complicated either.
May 4, 2007 at 10:08 am
Thanks, and how do you split the source table based on the delimiter that's in the first column and move it to destination table? Basically how do you parse for the delimiter and point fields to proper destination column.
May 7, 2007 at 8:46 am
As a last resort, you might try writing a procedure in the CRL of your choice. .NET languages are a good choice for complex string parsing.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply