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 «««1234

Importing Poorly Formatted Text File Expand / Collapse
Author
Message
Posted Friday, August 1, 2014 11:18 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 5:34 PM
Points: 35,609, Visits: 32,200
Thank you for the feedback.

Shifting gears to your latest and I have to ask, where did that particular file come from?

Thinking about the problem at hand with that file, is the format for each section (1 per DN) reliable insofar as position on the line for each "line type"? If so, this could be incredibly easy to solve because that would make it a simple substring/screen scraping problem. I'd just read a whole block as a single string (including the Cr/Lf combinations and map it out for substring extraction.

Also (and asking because the file you attached is obviously a snippet of a larger file), does that last section end with the constant string of dashes as the other sections do?


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1598847
Posted Friday, August 1, 2014 11:25 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 5:34 PM
Points: 35,609, Visits: 32,200
Ah... scratch one of those questions. I see that the first section has quite a few extra line types. I do, however, still need to know if the last section in the file has all the dashes at the end of the section that the other sections do.

That does bring up another question, though. Which "fields" do you want out of that file?


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1598848
« Prev Topic | Next Topic »

Add to briefcase «««1234

Permissions Expand / Collapse