SQLTeam.com | Weblogs | Forums

How we run the below command with out using .bat file


Help needed.
I want to run the below script with out using .bat file from SQL Server agent .


cd \vinod_jobs\vinod_extract-scripts_2020-04-08

sqlcmd -S localhost -d databasename -h -1 -s "|" -i vinod-specialties-3.sql -W -w 2000 -o "\servername\d$\vinod\Output\Vinod-specialties-%DATE:~-4%-%DATE:~4,2%-%DATE:~7,2%-%TIME:~0,2%-%TIME:~3,2%-%TIME:~6,2%.dat"

Thanks in Advance.

Vinod Thomas

I thought you could just put all that right into the job step. You'll need to make sure the file is there and accessible with SQL Agent account. Not sure about the ~ values though. Also, add -Q to that string