Job name from SQL Server Agent

  • This is a very weird question I am asking.  I have DTS package configured as job in SQL Server Agent. this DTS package has to get the retry attempt of the job and has to function accordingly.

    Right now, I am passing the job name as a parameter to system stored procedures.  Therefore the job name has to be stored as global variable.  Of course it is not going to happen quite often, but if someone changes the job name, the global variable has to be changed too.

    My question is: When job runs from SQL Server Agent, is it possible for DTS package to know (through some system stored procedures or writing user procedures) the name of the job??

    Thanks in advance for your comments/answers.

     

     

     

     

  • Can you use job ID (from sysjobs table in MSDB) instead of job name as global parameter? So, the job can be renamed any time. In this case just don't recreate job (like drop and create again).

  • Thanks for your reply.

    Yes I thought about using job ID. But still there are chances that someone might delete the job and create new one.  I will use job ID as last thing.

    To make things complicate, the job has couple steps.  Is there step Id along with step name.  I will have to look in to it.

    Thanks again.

     

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

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