OUTPUT as Text File

  • Hello All

    I am trying to generate a comma delimited text file from a query that is generated via a Stored Proc. I am not sure how to do this. It has been to long since I last did this. How can i easily write this into my Stored Proc?

    Thanks

    Andrew

    How long a minute is....

    Depends on what side of the bathroom door you are on.


    How long a minute is....
    Depends on what side of the bathroom door you are on.

  • There are several ways. The best from the perfomance viewpoint is to use bcp utility. If you need to call it from a stored procedure, then execute xp_cmdshell 'bcp...'. You can specify the coma-delimeted output file format. Look for the bcp option parameters

  • Thanks very much. I will try it that way. I am used to using bcp. I just could not think of the xp_cmdshell SP. I used to do this alot with 6.5 but it has been along time ago.

    Thanks again

    Andrew

    How long a minute is....

    Depends on what side of the bathroom door you are on.


    How long a minute is....
    Depends on what side of the bathroom door you are on.

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

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