Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2007

    Unanswered: Need to save a query to csv file

    I have a query that I want to execute as a stored procedure, so I can schedule it. I need the results to be exported to a csv file format. I have created a batch BCP script to run the query and dump the results to a file, but when I try to run the xp_cmdshell in my stored procedure, it is not cannot be found. I assume it is not installed. I viewed the advanced settings and it wasn't even listed.

    How can I go about this in another way? Any ideas? I have 2 queries that are running data, and the 3rd query is pulling the summary of this data to a file. If you can help me out, please let me know. Thanks!

  2. #2
    Join Date
    Jun 2003
    Provided Answers: 1
    More likely xp_cmdshell cannot be found because you did not specify the master database when you invoked it, or the use of xp_cmdshell is disabled on your server.

    Regardless, the proper way to handle this is to export your sproc results using SSIS or DTS, and schedule the package to run as a job.
    If it's not practically useful, then it's practically useless.

    blindman "sqlblindman"

  3. #3
    Join Date
    Jun 2004
    Long Island

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts