Machine
SSC Journeyman
Points: 93
More actions
January 22, 2009 at 4:18 pm
#126938
Hi All,
I am wondering if it is possible to programmatically access the name of a SQL Job from one of the steps of that job, using TSQL?
eg, something like : SELECT [@JOBNAME] ?
Many Thanks
happycat59
One Orange Chip
Points: 29389
January 22, 2009 at 8:30 pm
#931607
You can't get the job name directly but you can get the job id which you can then use to lookup the name of the job (in msdb.dbo.sysjobs)
Have a look in MSDN for Using the article called "Tokens in Job Steps". It happens to include an example on how to access sysjobs.
January 22, 2009 at 9:59 pm
#931630
Thankyou - that's what I was looking for.
Cheers
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply