Sunday, February 19, 2012

Checking for stored procedure return code in SQL Agent job

I am relatively new to SQL Agent job creation. I am trying to create a job that will check for disabled triggers and notify an operator. The job step I have created is Transact-SQL. I am checking sys.triggers for disabled triggers. My question is:

How do I indicate whether the job step was a success or failure in the TSQL, so I can trigger the correct response to it?

Can I check the return code from a stored procedure to determine success or failure?

Thanks,

Larry

I would think that it could be a bit more 'robust' to have a DDL trigger that would set off your alert process upon an ALTER TRIGGER event...

Otherwise, use RAISERROR when a row with disabled trigger if found.

No comments:

Post a Comment