I am running MSSQL 2012 on Windows 2008
I have a SQL Query that is run on a daily basis and outputs to a Text file. This is done by a Batch file that uses SQLCMD similar to the following ; sqlcmd -S %SERVERNAME% -d DATABASE -s "|" -m1 -W -h-1 -i J:\Folder1\Query1.sql -o J:\Folder1\Output\Results_%DATE:~4,2%_%DATE:~7,2%_%DATE:~-4%.txt
This Batch file is kicked off using Windows Task Scheduler. Once it completes another batch file is scheduled to move the file from the local folder to a shared folder on another server.
The SQL Query Batch is beginning to run long and past the start time of the Move Batch. I have adjusted the start times to fix this, but I do not want to keep doing this.
What I would like to do, if possible, is leverage SQL Server Agent to schedule a job in SSMS the Runs the Query and Outputs the results directly to the Shared folder on the other server. Is this possible? If so How?