Question

I want to run a series of scripts in command shell every day. These will be executed from windows / shell -NOT FROM SQL directly.

I'm using bcp on a stored procedure that reformats the data. The stored procedure returns the correct data. Let's say my database is called MYDB and the procedure is called "MYSP" The server is MYSERVER

I'm trying combinations of things like:

BCP "EXEC MYDB.dbo.MYSP" -SMYSERVER  f "export_stuff.xml" queryout "test_export.dat" -T -c

Instead of doing anything useful or printing an error message, it just prints out the usage instructions.

What is the call?

Was it helpful?

Solution

bcp "EXEC %db%.dbo.EXPORT_TABLE" queryout dataout.txt -SMYSERVER -T -c -r"\n" -t"" > output.txt
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top