I have a very simple batch file to query out the SQL table and want to run it through SQL job. However it says "The system cannot find the path specified". I ran the batch file itself then it works great and I changed the drive to my local hard drive which is C:/
sqlcmd -S COBDATA -d Prod -E -Q "select ADD_FULL from dbo.address where ACTIVE = 1" -s "," -o "C:\Student\SqlToText_%date:~-10,2%%date:~-7,2%_%date:~-4,4%.txt"
In SQL Job,
Type: Operating system(CmdExec)
Run as: SQL Server Agent Service Account
Command: cmd.exe /c "C:\Student\address.bat"
It seems like sql server agent doesn't recognize C drive. when I add cmd without any drive letter then it works. any idea?