Hi All,
I wrote a bat file to start a sql job using dos command
osql -S “[SQL SERVER NAME]” -E -Q”exec msdb.dbo.sp_start_job ‘[SQL JOB NAME]'”
ref http://www.rklesolutions.com/blog/run-sql-agent-job-windows-bat-file/
now this bat file only start the job, does not wait for it completion or send us the success or failure message.
Now i want to check the value of LastRunStatus for this job using BAT file?? Is is possible to fetch the LastRunStatus of sql job using bat file.
Please give your solution if you have any.
However i have achieved the same using vbscript that starts a job using vbscript start method and then looping through al the jobs at server and displaying the LastRunStatus.
However i wanted to achieve this uisng bat file only.