Is there any way to identify which SQL Agent job is running a stored procedure?
The reason I want this is that I'd like to have a separate step, that runs on failure, that has a stored procedure which will email the log file. To get the log file (we always use only one log file per job, not per step), I'd like to just be able to get the log file by querying the MSDB tables (select output_file_name from sysjobsteps
).
I could pass a parameter with the job name to the stored procedure, but I'd like to not need to do that.
Any ideas?
thanks!