September 19, 2007 at 11:40 am
We have a comma delimited flat file where the number of columns is not fixed for each row.
Is there any SSIS task that will allow reading such a flat file format?
September 19, 2007 at 9:46 pm
I've run into this before, and ended up running it through a script task to standardize the format.
Tim Mitchell, Microsoft Data Platform MVP
Data Warehouse and ETL Consultant
TimMitchell.net | @Tim_Mitchell | Tyleris.com
ETL Best Practices
September 19, 2007 at 10:56 pm
Heh... yeah... I've run into this a couple of times my own self... most of the time, I pummeled the vendor until they provided correct data.
When all hope was lost, I did it the way Tim suggested.
--Jeff Moden
Change is inevitable... Change for the better is not.
September 20, 2007 at 1:43 am
The best option, as suggested, get the source right. of course, this is not always easy.
An option would be to use a ragged right. Split on the first comma or the highest low number of commas and use a derived column to split the rest. Not sure if it would be easier that a script component. Might be a bit faster. Will have to test though...
Cheers,CrispinI can't die, there are too many people who still have to meet me!It's not a bug, SQL just misunderstood me!
September 20, 2007 at 8:35 am
Thanks for the replies guys.
I thought there is probably an easier way and we wouldn't have to write a script task. The columns are comma delimited and the rows are CR/LF delimited so I thought SSIS might be able to read the row delimiter and substitute the remaining columns to null. But I guess not.
Will try to work with changing the source or defaulting to the script task.
Thanks
September 20, 2007 at 8:39 pm
... or....
You could import whole lines into a very wide column and split them there using a split function...
... or ...
You could do the same but a bit different... import whole lines into a very wide column, add the correct number of commas, export, and then re-import. I think you'll find that to be surprisingly fast. My even be able to use an OPENDATASOURCE or OPENROWSET to modify the file directly (although, I've never done that particular deed myself).
--Jeff Moden
Change is inevitable... Change for the better is not.
September 28, 2007 at 9:10 pm
Hi,
I am having the same issue, but with a fixed length file (Rugged Right)..
But there here is an excellent example for the comma delimited :
The only problem with this example is that this can only work with task that require only a few transformations. I am working on finding a more of a universal approach to the problem.
September 28, 2007 at 9:56 pm
Are you guys all trying to make me believe that there are some bad vendor apps out there :hehe:??
September 29, 2007 at 3:54 pm
Heh... why sure, Remi... just look at the difficulties Steve is having trying to fix some of the problems with this "forum in a can" code that RedGate bought. 😛
--Jeff Moden
Change is inevitable... Change for the better is not.
September 29, 2007 at 4:15 pm
He's not having any troubles... it's just the other 2-3 programmers who are having a hard time :hehe:.
October 2, 2007 at 10:54 am
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply