dbTalk Databases Forums  

Text File Source - end-of-line character problem

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


Discuss Text File Source - end-of-line character problem in the microsoft.public.sqlserver.dts forum.



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

Default Text File Source - end-of-line character problem - 07-01-2004 , 04:33 AM






I'm being sent a pipe-delimited text file with insufficient end-of-line
characters.

When I open the file in notepad, each line DOES NOT terminate correctly, and
it reads it as one long string
When I open the file in wordpad/word etc, each line DOES correctly terminate
and start a new line.

Therefore, when I try to read the file in using a text file source, it
causes problems. If I open teh file in wordpad, and save, then try again it
works....

Unfortunately I have no control over the text file.

Is there a solution to this?

Thanks.
BW




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

Default Re: Text File Source - end-of-line character problem - 07-01-2004 , 05:22 AM






In message <eadKv50XEHA.3716 (AT) TK2MSFTNGP10 (DOT) phx.gbl>, Beema
<none (AT) supplied (DOT) com> writes
Quote:
I'm being sent a pipe-delimited text file with insufficient end-of-line
characters.

When I open the file in notepad, each line DOES NOT terminate correctly, and
it reads it as one long string
When I open the file in wordpad/word etc, each line DOES correctly terminate
and start a new line.

Therefore, when I try to read the file in using a text file source, it
causes problems. If I open teh file in wordpad, and save, then try again it
works....

Unfortunately I have no control over the text file.

Is there a solution to this?

Thanks.
BW

Is the line termination inconsistent, or are all lines formatted
correctly but with a terminator notepad does not display as you expect?

If the former then you will need to parse the file and fix the problems.
If the latter then it sounds like there is a perfectly valid terminator,
just not one that is visible in notepad.

Since you can select or at least set via code any row terminator you
want in DTS, this isn't a problem, just make the correct selection.
Start by using a hex editor to open the file and identify the terminator
character. Then select this correct in the DTS connection UI, or use
some ActiveX Script to set it where the character is not available from
a keyboard.

Coping with text files and abnormal column or row delimiters
(http://www.sqldts.com/default.aspx?257)

--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org



Reply With Quote
  #3  
Old   
Beema
 
Posts: n/a

Default Re: Text File Source - end-of-line character problem - 07-01-2004 , 05:56 AM





"Darren Green" <darren.green (AT) reply-to-newsgroup-sqldts (DOT) com> wrote

Quote:
In message <eadKv50XEHA.3716 (AT) TK2MSFTNGP10 (DOT) phx.gbl>, Beema
none (AT) supplied (DOT) com> writes
I'm being sent a pipe-delimited text file with insufficient end-of-line
characters.

When I open the file in notepad, each line DOES NOT terminate correctly,
and
it reads it as one long string
When I open the file in wordpad/word etc, each line DOES correctly
terminate
and start a new line.

Therefore, when I try to read the file in using a text file source, it
causes problems. If I open teh file in wordpad, and save, then try again
it
works....

Unfortunately I have no control over the text file.

Is there a solution to this?

Thanks.
BW


Is the line termination inconsistent, or are all lines formatted
correctly but with a terminator notepad does not display as you expect?

If the former then you will need to parse the file and fix the problems.
If the latter then it sounds like there is a perfectly valid terminator,
just not one that is visible in notepad.

Since you can select or at least set via code any row terminator you
want in DTS, this isn't a problem, just make the correct selection.
Start by using a hex editor to open the file and identify the terminator
character. Then select this correct in the DTS connection UI, or use
some ActiveX Script to set it where the character is not available from
a keyboard.

Coping with text files and abnormal column or row delimiters
(http://www.sqldts.com/default.aspx?257)

--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org


The default Row Delimeter was {CR}{LF} but the file didn't have the Carriage
Return. I set it to just {LF} and it works fine now.

Thanks for your help.




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.