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?

有帮助吗?

解决方案

bcp "EXEC %db%.dbo.EXPORT_TABLE" queryout dataout.txt -SMYSERVER -T -c -r"\n" -t"" > output.txt
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top