dbTalk Databases Forums  

Parsing TXT file using VB Script

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


Discuss Parsing TXT file using VB Script in the microsoft.public.sqlserver.dts forum.



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

Default Parsing TXT file using VB Script - 01-08-2004 , 10:49 PM






Hello There!
I have been trying to parse a TXT file so it is ready to
be used in a DTS package, basically to be copied into a
table.
I basically need to do the following:

1. Delete first two lines
2. change last column name to Cur Cod2
3. Then save the text file so it is saved with correct
row delimiter for the first line which contains the
columns headers. When i tried to do this i got this
error: "Could not find the selected row delimiter within
first 8 kb of data; is the selected row delimiter correct?

It seems like that the row delimiter has several lines.

I got to open the file using the File Scripting Object
Open the file set x = oFSO.OpenTextFile("E:\TEST.txt")
but cannot get pass this.

Indeed very apprecitated any help on this


martino

Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Parsing TXT file using VB Script - 01-09-2004 , 01:34 AM






The DTS package probably thinks that you have not terminated your rows of
data properly. It then keeps looking through the text file to see if it can
find them. If it cannot then it reports the error you see (8KB is the rows
length max in SQL Server). Grab yourself a hex editor as well and have a
look at hpw your rows are really terminated

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





--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"martino rivaplata" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hello There!
I have been trying to parse a TXT file so it is ready to
be used in a DTS package, basically to be copied into a
table.
I basically need to do the following:

1. Delete first two lines
2. change last column name to Cur Cod2
3. Then save the text file so it is saved with correct
row delimiter for the first line which contains the
columns headers. When i tried to do this i got this
error: "Could not find the selected row delimiter within
first 8 kb of data; is the selected row delimiter correct?

It seems like that the row delimiter has several lines.

I got to open the file using the File Scripting Object
Open the file set x = oFSO.OpenTextFile("E:\TEST.txt")
but cannot get pass this.

Indeed very apprecitated any help on this


martino



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

Default Re: Parsing TXT file using VB Script - 01-09-2004 , 03:12 AM



http://msdn.microsoft.com/library/de...FileSystem.asp

Have a look at the TextStreamObject, which has both ReadLine and WriteLine
methods. You will need to read the data from one file and write what you
want to keep into a second file.

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

"martino rivaplata" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hello There!
I have been trying to parse a TXT file so it is ready to
be used in a DTS package, basically to be copied into a
table.
I basically need to do the following:

1. Delete first two lines
2. change last column name to Cur Cod2
3. Then save the text file so it is saved with correct
row delimiter for the first line which contains the
columns headers. When i tried to do this i got this
error: "Could not find the selected row delimiter within
first 8 kb of data; is the selected row delimiter correct?

It seems like that the row delimiter has several lines.

I got to open the file using the File Scripting Object
Open the file set x = oFSO.OpenTextFile("E:\TEST.txt")
but cannot get pass this.

Indeed very apprecitated any help on this


martino



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.