Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««23456

Simple Method for Importing Ragged files Expand / Collapse
Author
Message
Posted Tuesday, May 20, 2008 9:44 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, October 23, 2014 1:54 PM
Points: 68, Visits: 376
We can all jump through flaming hoops to accomplish our ETL. However, there are limits on what we can or should accept as input. If the data format can't be parsed with consistent business rules that can be coded in T-SQL or C# or VB.Net, then we really can't process the file. Columns have to either be fixed-length or have a well defined delimiter. Same with row termination. It needs to be something that we can parse with the tools at hand.

We have powerful tools, bcp, bulk insert, SSIS and others, but they can't guess at what the data is supposed to be. They have to be told what the data is supposed to be, and then when it isn't we must handle the exceptions.

IMHO, It is acceptable to go back to the people who own the source data and say to them that a data format is unacceptable for specific reasons. Otherwise we need to hire a roomful of 10-key data entry clerks. Remember those days?

Brandon_Forest@sbcglobal.net
Post #503831
Posted Tuesday, May 20, 2008 10:10 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, January 27, 2014 10:14 AM
Points: 1,322, Visits: 1,091
I get these files which are basically text streams and they are only delimited by record.

I've written a utlity to handle it now (it's slow and difficult to manage on all my remote sites) but is there anything already in SSIS that would just delimit the row at a specified length?


If you just need to break at a specified length, I would look at something like sed to add a row delimiter:

sed s/.../(&)"\ n"/g
(remove the space in \ n)
should add a CRLF after every 3 characters.

Dump the output into a new file and process it using bcp.
--
JimFive
--Edit to fix filtered text.
Post #503852
« Prev Topic | Next Topic »

Add to briefcase «««23456

Permissions Expand / Collapse