Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2003
    Posts
    11

    Unanswered: DTS headers and trailers

    Does anyone know how to incorporate header and trailer info in the text output from a DTS task. The SQL I'm using in the task works well when outputting to a text file on the server. However, when trying to incorporate header and trailer info the process fails. I tried doing it using SQL but the DTS transformation process is looking for fields to transform when I'm trying to output a 3 line header and 2 line trailer with the output rows in between. Has anyone done this before? Your help would be greatly asppreciated.

    Here is an example of the SQL that fails:

    *** Trying to get header info here ***
    select 'Header'
    select 'filename.txt'
    select convert(char(11),getdate(),101)

    *** Main SQL runs here ***
    select
    a.field1,
    a.field2,
    ...

    from tblA a JOIN tblB b ON b.someid = a.someid
    JOIN tblC c ON c.someid = a.someid

    where a.someval >= '2003'

    *** Trying to get trailer info here ***
    select 'Trailer'
    select ''
    select count(id) FROM tblA

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    I'd bcp out three files (or echo out the header and trailer)

    Then append the files to each other using dos commands...
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Jun 2004
    Location
    Long Island
    Posts
    696
    Quote Originally Posted by Brett Kaiser
    I'd bcp out three files (or echo out the header and trailer)

    Then append the files to each other using dos commands...
    do it all the time, works perfectly.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •