BCP to export to a file

  • I am trying to export a table to a file. I use bcp command to do this. I need the column names as header in the file. How do i do this? Any help is appreciated.

    I am doing this by calling bcp using xp_cmdshell in a stored procedure.

    Give me a fish, you feed me for a day! Teach me to fish, you feed me for a life time.

  • Just a thought, why not check out DTS to do this job. I have to create similar exports on a regular bassis and I've found that DTS gives me far mor flexibility and control than BCP


    I have found it is possible to please all of the people all of the time if you do exactly what they want. Harold Macmillan 1961

  • I agree with crosspatch. DTS is far more flexible it creatigna structured file liek you are speaking out. BCP does not allow direct output of the column names as headers. And you can execute a DTS package within a stored procedure.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

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

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