export to text with twist

  • Hello All,

    I need to export result of a query (single column) to a text file. Simple enough-can be done with bcp or DTS. Additionally, I need to add an extra column (repetitve) to text file and few unique words to it.

    Is there a SIMPLE way to do it?

    Simplified, Before in text file:

    212-589-3211

    718-891-5555

    917-897-8978

    What I need to get is the following:

    Andrews Phone Book

    phone: 212-589-3211

    phone: 718-891-5555

    phone: 917-897-8978

    End of Phone Book

    I hi-lited required additions in bold.

    TIA

  • concatenation in query and bcp query out.

    select 'Andrews Phone Book'

    union

    select 'phone:'+col from table

    union

    select 'End of Phone Book'

Viewing 2 posts - 1 through 1 (of 1 total)

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