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
 Import/Export (DTS) and Replication (2000)
 Header and Footer in destination text file

Author  Topic 

karuna
Aged Yak Warrior

582 Posts

Posted - 2005-03-28 : 23:32:21
Hi,

I need to export some data from sql to text file. The text file should have a header like ***---*** followed by data from sql table and end with footer like **EOF**

Any body have idea on how to do this?. I tried to have 3 different files, header.txt, footer.txt, tempdatafile.txt after importing the data from sql to tempdatafile.txt I have a activex task which creates a text file(FinalFile.txt) and batch file(sqlbatch.bat)
The batch file has following contets
copy finalfile.txt+header.txt+tempdatafile.txt+footer.txt

I call this batch file using execute process task in dts, when I execute I dont any errors and also the files are not copied to the finalfile.txt, when I execute the same batch file from command prompt the datas of the other 3 files gets copied to finalfile.txt

The Flow is here:



Any idea what could be wrong?...Or any other idea on how to achieve this? I tried multiphase data pump I couldnt get hold of much articles on how to work with it.

Please somebody help me...

nr
SQLTeam MVY

12543 Posts

Posted - 2005-04-02 : 14:23:03
try in the batch file

type header.txt > finalfile.txt
type tempdatafile.txt >> finalfile.tx
type footer.txt >> finalfile.tx


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

karuna
Aged Yak Warrior

582 Posts

Posted - 2005-04-04 : 00:06:30
Thanks NR.

Its working...Atleast for now... Is there any other alternative way of doing this? many topic suggest this can be done (Writing a header and footer) with Multiphase Data Pump...Any ideas how to do that?

Thanks again.

Karunakaran
Go to Top of Page
   

- Advertisement -