dbTalk Databases Forums  

trailer or header in a flat file

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


Discuss trailer or header in a flat file in the microsoft.public.sqlserver.dts forum.



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

Default trailer or header in a flat file - 09-15-2003 , 02:01 PM






Is there any way DTS can read a trailer or header in a
text file. Let say this is the flat file:

101 20056 NV01 103635 Decatur & Craig
102 30123 NV01 103636 Drake Plaza
103 26522 NV01 103636 Drake Plaza
104 56222 CA01 105326 West & Decatur
## 20030912 506040

The last line ## has the date and the character count for
the file. How can I have my DTS package read this last
line and dump the information in someplace else.

Thanks is advance for any help. Sandra

Reply With Quote
  #2  
Old   
Peter Hall
 
Posts: n/a

Default Re: trailer or header in a flat file - 09-16-2003 , 06:04 AM






The answer is to use an ActiveX object in DTS and use the
Scripting.FileSystemObject, this will allow you to read an input file line
by line and you can choose where to write the data depending on the data.

This can be slow for large files.

Pete

"Sandra" <silvah (AT) wellsfargo (DOT) com> wrote

Quote:
Is there any way DTS can read a trailer or header in a
text file. Let say this is the flat file:

101 20056 NV01 103635 Decatur & Craig
102 30123 NV01 103636 Drake Plaza
103 26522 NV01 103636 Drake Plaza
104 56222 CA01 105326 West & Decatur
## 20030912 506040

The last line ## has the date and the character count for
the file. How can I have my DTS package read this last
line and dump the information in someplace else.

Thanks is advance for any help. Sandra



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

Default Re: trailer or header in a flat file - 09-21-2003 , 11:22 AM



In article <uxv0MJEfDHA.2236 (AT) TK2MSFTNGP12 (DOT) phx.gbl>, Peter Hall
<pete_ha11 (AT) hotmail (DOT) com> writes
Quote:
The answer is to use an ActiveX object in DTS and use the
Scripting.FileSystemObject, this will allow you to read an input file line
by line and you can choose where to write the data depending on the data.

This can be slow for large files.

Pete

"Sandra" <silvah (AT) wellsfargo (DOT) com> wrote in message
news:034e01c37bbb$ba04bf80$a301280a (AT) phx (DOT) gbl...
Is there any way DTS can read a trailer or header in a
text file. Let say this is the flat file:

101 20056 NV01 103635 Decatur & Craig
102 30123 NV01 103636 Drake Plaza
103 26522 NV01 103636 Drake Plaza
104 56222 CA01 105326 West & Decatur
## 20030912 506040

The last line ## has the date and the character count for
the file. How can I have my DTS package read this last
line and dump the information in someplace else.

Thanks is advance for any help. Sandra


or create individual files and use the DOS copy command the merge them
together, e.g.

copy header.txt+data.txt+footer.txt file.txt


--
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
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.