![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello, I have been asked to produce a regular extract from an SQL Server and that the extract contain a Header Record and a Trailer Record, consisting of several fields. Does anyone know of a way to do this in SQL Server (DTS)? Thanks in advance. Brent |
#3
| |||
| |||
|
|
There are a few ways...depends on the details of what you are doing. You can create three files: a header file, the data file, a trailer file. Then you can combine the files into the final extract file using the DOS copy command with something like: COPY Header.txt + Data.Txt + Trailer.txt FinalExtract.txt You could use a SQL statement that unions the header, data and trailer info. You could also use the Multiphase Data Pump functionality to do this. I think the first approach is often cleaner or easiest to understand and maintain. -Sue On Mon, 13 Sep 2004 03:13:03 -0700, "Brent C" BrentC (AT) discussions (DOT) microsoft.com> wrote: Hello, I have been asked to produce a regular extract from an SQL Server and that the extract contain a Header Record and a Trailer Record, consisting of several fields. Does anyone know of a way to do this in SQL Server (DTS)? Thanks in advance. Brent |
#4
| |||
| |||
|
|
Missed on the Multi-Phase data pump. I wrote out to 3 files, then combined them in a VBScript/ActiveX task. I can probably dig up the code if anyone's interested. Works great except for when one of the files is 0 bytes. :-) Let me know if you'd like a sample or two. -Pete Sue Hoegemeier <Sue_H (AT) nomail (DOT) please> wrote: There are a few ways...depends on the details of what you are doing. You can create three files: a header file, the data file, a trailer file. Then you can combine the files into the final extract file using the DOS copy command with something like: COPY Header.txt + Data.Txt + Trailer.txt FinalExtract.txt You could use a SQL statement that unions the header, data and trailer info. You could also use the Multiphase Data Pump functionality to do this. I think the first approach is often cleaner or easiest to understand and maintain. -Sue On Mon, 13 Sep 2004 03:13:03 -0700, "Brent C" BrentC (AT) discussions (DOT) microsoft.com> wrote: Hello, I have been asked to produce a regular extract from an SQL Server and that the extract contain a Header Record and a Trailer Record, consisting of several fields. Does anyone know of a way to do this in SQL Server (DTS)? Thanks in advance. Brent |
![]() |
| Thread Tools | |
| Display Modes | |
| |