SQL Job Information

  • I've written lots of TSQL to interrogate the system for information about SQL jobs. But I have a need that I haven't found an answer for...

    Is there anyway for an executing job (TSQL) to get job information about itself???

    I've thought about enbedding the jobname/id as a variable inside the job but... I wanted to see if the job could figure out who it was and get information about itself.

    Thanks

    Glenn

  • Try use APP_NAME() inside the code executed by Job.

    It will return string like this:

    SQLAgent - TSQL JobStep (Job 0x{Job_ID} : Step {N})

    Let me know if you need further explanations.

    _____________
    Code for TallyGenerator

  • Thanks Serqiy - that will work just fine!

    Glenn

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply