Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 DTS Advice - Appending to a Text File

Author  Topic 

heygee
Starting Member

27 Posts

Posted - 2006-01-26 : 04:43:47
Hi all,

I am having a problem with a DTS package I am writing. The package is getting text from a table and putting it out to a text file. I have most of it sorted, and contains text like this:
PN,GEN,T_KI-3,2006-01-24 00:30,480,2006-01-24 01:00,480
PN,GEN,T_KI-2,2006-01-24 00:40,484,2006-01-24 02:00,482
PN,GEN,T_KI-3,2006-01-24 00:50,490,2006-01-24 05:00,486
What I need is a line at the end of the text which is:
<EOF>

So the output from this will look like:
PN,GEN,T_KI-3,2006-01-24 00:30,480,2006-01-24 01:00,480
PN,GEN,T_KI-2,2006-01-24 00:40,484,2006-01-24 02:00,482
PN,GEN,T_KI-3,2006-01-24 00:50,490,2006-01-24 05:00,486
<EOF>

I am having problems adding the line at the end of the text file. Can anyone advice me of a good solution or show me where I amn going wrong?

TAI,
Gee

Gee

"Happiness is a good health and a bad memory!"

AndyB13
Aged Yak Warrior

583 Posts

Posted - 2006-01-26 : 05:28:27
You could try

EXEC master..xp_cmdshell 'echo EOF >> C:\test.txt', NO_OUTPUT

I removed <> from EOF as it doesnt like it unless encapsulated in ""

Andy

Beauty is in the eyes of the beerholder
Go to Top of Page

heygee
Starting Member

27 Posts

Posted - 2006-01-26 : 05:58:03
Thanks, but I have just tried this as an extra step in the DTS Package and also included in the original scrip. Were you able to get this to work as it doesn't seem to work for me.

Gee

"Happiness is a good health and a bad memory!"
Go to Top of Page

AndyB13
Aged Yak Warrior

583 Posts

Posted - 2006-01-26 : 07:16:51
Yes that works, run it in QA.
The >> appends to the file a single > creates/overwrites a file

Dont forget that the file will be wherever the connection is set to (may not be local), i have made that mistake a few times when i thought it wasnt working

Andy

Beauty is in the eyes of the beerholder
Go to Top of Page

jsiedliski
Yak Posting Veteran

61 Posts

Posted - 2006-08-24 : 19:58:42
Anyone know if you can force DTS to easily append to the same text file? (by default DTS deletes the file, if it exists and creates a new one). I am sure it could be done using ActiveX, but was wondering if there was an easier way.

Thanks,

Jack

:)
Go to Top of Page
   

- Advertisement -