Export Data to Text File with Fixed Positions - How?

  • I am trying to export a subset of data from one table in SS 2000 with fixed positions.  Here is an example of the Export file spec:

    Field      Type        Bytes    First Pos    Last Pos    Format

    mkk        Char         11        1                 11            LJ

    bnu         Number      6         12               17            RJ,zero-fill

    date       Char          8         18               25            YYYYMMDD

    amount    Number      13        26              38            s999999999.99

    type       Char          10        39              48            LJ

    From this spec and fields I need to export, there are a total of about 50 fields that need to feed into this text file.  Half of these fields are not in the database and thus such should be blank, e.g. 123TEST  34239.  I would also like to timestamp these export files with the day's date, i.e. export should run daily. 

    Can someone please direct me to some good sources and/or give me a starting point?  Any and all information will be greatly appreciated.

  • This was removed by the editor as SPAM

  • hi

    You could use DTS for exporting to a fixed width txt. The method below may not be the fastest so I guess it depends on how may records you're going to be exporting on a typical day.

    1 in dts open a connection to the DB you want

    2 include a text file destination (set this up as a fixed width file output)

    3 use a data transform task between the two.

    In the data transform task you can define the destination columns you want to appear in the txt and map them from the source - which you can define with a select statement.

    If you want to timestamp the output files you could experiment with a Dynamic Properties task and use it to alter the name of the txt file.

    Hope that gives you a starting point!

  • Hi,

    use data driven query that will help u.

    Hope it helps u.

    from

    killer

     

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply