Home Forums SQL Server 2005 Development Output a sql resultset to csv automatically with sql job RE: Output a sql resultset to csv automatically with sql job

  • Ok...

    If I run the batch when I'm logged into the server, it works fine. I'm assuming it is using my credentials to access the network location.

    As you can see from my code example previously, I do reference the network location by server name ("\\temp-shed-40"). The D drive is a local drive for the SQL server.

    I tried xp_cmdshell, with the previously provided error.

    Any ideas on how to run this command:

    sqlcmd -S ECOM-VS-01 -i "d:\sqlcode\backorder.sql" -o "\\temp-shed-40\public\backorder.csv" -s"," -h-1 -W

    as a SQL agent job?

    I tried putting this into a step for a job and received the same error.

    Thank you for your help.

    Jason