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
 SQL Server Development (2000)
 Concatenating output files into one file

Author  Topic 

keg
Starting Member

2 Posts

Posted - 2003-07-09 : 23:56:28
Hi,

I need to be able to produce one output file
which contains records of differing lengths -
a header record, multiple transaction records and a trailer record -
do I concatenate 3 files together (if so how do I do this in sqlServer/Windows)
or can I create one file with all 3 record types.

Will bcp help in this at all?

nr
SQLTeam MVY

12543 Posts

Posted - 2003-07-10 : 03:05:52
I usually create the output file image in a global temp table from an sp and bcp that out. It makes dev easy because you just have to display the temp table.

If you want to create 3 file and concatenate then

exec master..xp_cmdshell 'type file1 > file'
exec master..xp_cmdshell 'type file2 >> file'
exec master..xp_cmdshell 'type file3 >> file'

or you could do it in one statement.

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

- Advertisement -