dbTalk Databases Forums  

Ignoring certain lines in text import in DTS

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


Discuss Ignoring certain lines in text import in DTS in the microsoft.public.sqlserver.dts forum.



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

Default Ignoring certain lines in text import in DTS - 04-24-2006 , 09:02 PM






hi everybody,
I have a hopefully easy problem to fix. I am trying to import a huge
text file into a table with DTS. The problem is that every 200,000
lines or so, the file has a bunch of lines in it that are not data.
There are about 5 lines that are some other information, and the
headers are recreated. When I try to import into DTS it always fails
when it reaches these lines since it didn't find the data delimiter.

Is there a way for me to tell DTS to ignore these lines, or if there is
an error in a line to just ignore it and keep going to the next line?
thanks!

P


Reply With Quote
  #2  
Old   
Walter Mallon
 
Posts: n/a

Default Re: Ignoring certain lines in text import in DTS - 04-25-2006 , 09:44 AM






In the options tab of the properties for the transformation, you can tell it
to ignore up to a certain amount of errors. You can also have it log the
errors so you can investigate them. I've solved this problem in the past by
runing the file through a vbscript which removes the bad rows of data by
using the File system object. You would open the file and read each line,
writing good rows to a new file and then import the new file.
Alternatively, you could do the transformation in a vbscript inside the
package and choose not to import rows based on whatever logic you decide.

Walter


"P" <amperie (AT) yahoo (DOT) com> wrote

Quote:
hi everybody,
I have a hopefully easy problem to fix. I am trying to import a huge
text file into a table with DTS. The problem is that every 200,000
lines or so, the file has a bunch of lines in it that are not data.
There are about 5 lines that are some other information, and the
headers are recreated. When I try to import into DTS it always fails
when it reaches these lines since it didn't find the data delimiter.

Is there a way for me to tell DTS to ignore these lines, or if there is
an error in a line to just ignore it and keep going to the next line?
thanks!

P




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.