locked
Creating a Header Record RRS feed

  • Question

  • Hi,

    I am new to SSIS and I am trying to create a package that will create a CSV File.

    The Thing is the file needs to include in it a Header Record, Detail Records and a Trailor Record.

    I have an SQL That brings me the data for the Detail Records.

    The Header Record is just 5 fields that will always be the same and I am wondering how to create this row of data manually? as it is not in any database.

    The Header record should look like this. H, GLOBE, CreationDate, Email Address, Group

    Same Idea for the Trailor Record.

     

     

     

    Thursday, September 15, 2011 4:15 AM

Answers

  • Hi,

    I am new to SSIS and I am trying to create a package that will create a CSV File.

    The Thing is the file needs to include in it a Header Record, Detail Records and a Trailor Record.

    I have an SQL That brings me the data for the Detail Records.

    The Header Record is just 5 fields that will always be the same and I am wondering how to create this row of data manually? as it is not in any database.

    The Header record should look like this. H, GLOBE, CreationDate, Email Address, Group

    Same Idea for the Trailor Record.

     

     

     


    See this post

    http://agilebi.com/jwelch/2008/02/08/adding-headers-and-footers-to-flat-files/

    also only header you can set in flat file destination using Header property in data flow task.


    Shailesh , Please mark the post as answered if it answers your question.
    • Proposed as answer by Todd McDermid Thursday, September 15, 2011 6:10 AM
    • Marked as answer by Eileen Zhao Wednesday, September 21, 2011 3:11 AM
    Thursday, September 15, 2011 4:54 AM

All replies

  • Hello,

    In the flat file connection manager, when u edit it, u will find a check-box for "Column Names in the first data row" by which u can get the header row if they are the same as the column names in the table or otherwise can be used from alias of the columns in the select query.

    For the trailer record, u can have a DFT selecting the string constant and write into the file. If there are different headers, and corresponding details and trailer records, it may be simpler to have the queries in a table and loop through them to write into a file.

    Seetha

    Thursday, September 15, 2011 4:45 AM
  • There is a forum that discussed this.  One poster had a detailed technique for doing this that looks like it would probably work well:

    http://www.sqlservercentral.com/Forums/Topic815666-148-1.aspx

    Now myself, I would probably just use a script component to create the header and footer.


    Tom Overton
    Thursday, September 15, 2011 4:49 AM
  • Hi,

    I am new to SSIS and I am trying to create a package that will create a CSV File.

    The Thing is the file needs to include in it a Header Record, Detail Records and a Trailor Record.

    I have an SQL That brings me the data for the Detail Records.

    The Header Record is just 5 fields that will always be the same and I am wondering how to create this row of data manually? as it is not in any database.

    The Header record should look like this. H, GLOBE, CreationDate, Email Address, Group

    Same Idea for the Trailor Record.

     

     

     


    See this post

    http://agilebi.com/jwelch/2008/02/08/adding-headers-and-footers-to-flat-files/

    also only header you can set in flat file destination using Header property in data flow task.


    Shailesh , Please mark the post as answered if it answers your question.
    • Proposed as answer by Todd McDermid Thursday, September 15, 2011 6:10 AM
    • Marked as answer by Eileen Zhao Wednesday, September 21, 2011 3:11 AM
    Thursday, September 15, 2011 4:54 AM
  • try selecting the option of header row contains names
    Thursday, September 15, 2011 5:27 AM
  • Will this help you ???

     

    • Proposed as answer by Achilles33 Wednesday, September 21, 2011 8:18 AM
    • Unproposed as answer by Achilles33 Wednesday, September 21, 2011 8:18 AM
    Thursday, September 15, 2011 7:48 AM