dbTalk Databases Forums  

Header & Trailer Records

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


Discuss Header & Trailer Records in the microsoft.public.sqlserver.dts forum.



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

Default Header & Trailer Records - 09-13-2004 , 05:13 AM






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

Reply With Quote
  #2  
Old   
Sue Hoegemeier
 
Posts: n/a

Default Re: Header & Trailer Records - 09-13-2004 , 07:14 AM






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:

Quote:
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


Reply With Quote
  #3  
Old   
Peter A. Schott
 
Posts: n/a

Default Re: Header & Trailer Records - 09-20-2004 , 03:28 PM



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:

Quote:
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


Reply With Quote
  #4  
Old   
LP
 
Posts: n/a

Default Re: Header & Trailer Records - 01-31-2005 , 12:33 PM



I would be very interested in a sample. Does this actually add a line to teh
text file? That's what I'm after.

Thanks,

LP

"Peter A. Schott" wrote:

Quote:
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



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.