New answers tagged sql-server-agent
Evaluate the result from the proc (with an IF statement) and then if you want it to fail the job execute a THROW command. See this article.
It would help to know which version of SQL Server you are using. You may get some information from the history of the job step itself. In SSMS, under SQL Server Agent, find the job. Right click the job and choose View History. Each entry in the Log File Viewer is one job run, so expand a failed run by clicking the [+] sign next to it. Highlight the ...
The other alternative would be to use operating system command and give powershell.exe c:/path/script.ps1 as command and save your script in script.ps1. This will ensure using OS powershell instead of using provider.
Starting an Agent job from a user database is common, and the best way to accomplish it is to use code signing. Books Online describes the concept here [http://msdn.microsoft.com/en-us/library/ms188304.aspx]. In your application database: Create a certificate Use ADD SIGNATURE to sign the stored procedure you wish to call sp_start_job Use ALTER ...
Top 50 recent answers are included