dbTalk Databases Forums  

Reading Variable Length Text file

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Reading Variable Length Text file in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jory
 
Posts: n/a

Default Reading Variable Length Text file - 07-11-2003 , 05:34 PM






How do I read in a text file that has fixed column
positions, but the last column is variable in length?
Each row has the appropriate terminating CRLF.

Reply With Quote
  #2  
Old   
Nigel Rivett
 
Posts: n/a

Default Re: Reading Variable Length Text file - 07-12-2003 , 04:38 PM






I do it by a bulk insert into a single column table then parse it via an
SP.

Nigel Rivett (SQL Server MVP)
www.nigelrivett.net

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Reply With Quote
  #3  
Old   
Darren Green
 
Posts: n/a

Default Re: Reading Variable Length Text file - 07-14-2003 , 05:22 AM



I always did this by pre-processing the file first, checking the length of
each row and pad with spaces as required.
There's a custom task that does this on my site, Padding Task. Alternatives
would be something like GAWK or write your own custom app. C or C++ would be
fastest.


--
Darren Green
http://www.sqldts.com

"Nigel Rivett" <anonymous (AT) devdex (DOT) com> wrote

Quote:
I do it by a bulk insert into a single column table then parse it via an
SP.

Nigel Rivett (SQL Server MVP)
www.nigelrivett.net

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.