I have this code in a job step, the stored procedure runs fine, the issue is with the getting of the job name.
declare @jobName varchar(100)
set @jobName = (select name from msdb..sysjobs where job_id = '$(ESCAPE_SQUOTE(JOBID))')
EXEC spSendSuccessEmail @jobName
Am I missing anything?
All I'm trying to do is pass the job id that the step is in to the stored procedure.
'$(ESCAPE_SQUOTE(JOBID))'get resolved to? Maybe try logging that to a table.