Formatting fields

  • Greetings all,

    I have been asked to submit data to a third party. The format is really a pain so here goes.

    1)All fields are left justified.

    2)Fields are fixed length, some are char, date is CCYYMMDD, some are int etc.

    3)All fields are space de-limited.

    4)Null records are padded by spaces.

    5)Records that do not fill the field are space padded.

    So someone really enjoys the space char..

    I don't need an elaborate solution, it's a one-time submission? so I'd like not to spend a whole lot of time on this ..what are my options?

     UDF? some builtin SQL functions? some other method?

    Any suggestions are greatly appreciated

    Darrin

  • Since its a one time job.

    The absolute easiest way is to define a temp table with the fields being char and the size requred by the client.

    Then insert your records into that table.

    Then select them out of your table into a file.

     

  • If you need more help, can you send some sample data and the required output so we know what you need?

  • <quote>I don't need an elaborate solution, it's a one-time submission? <end quote>

    Beware of this.....usually once you show you can provide something, or provide it in a special format, the client requests it over and over.

    -SQLBill

  • I usually go mid way in a new task. I try to automate it as much as possible without losing to much time... but when I get it asked again, I finish it (in half the time) .

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

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