Is there a way to determine which SQL agent job executes the stored procedure?
The reason I want it is because I would like to have a separate step that is executed on failure, which stores a procedure that will send a log file by email. To get the log file (we always use only one log file for each job, not per step), I would just like to get the log file by querying the MSDB tables ( select output_file_name from sysjobsteps
).
I can pass the parameter with the name of the job to the stored procedure, but I would not want to do this.
Any ideas?
thanks!
source share