Search code examples
sql-server-2008-r2sql-agent-job

Sql Server Agent Job - Adding Version Number


I created a monitoring tool using sql server 2008 r2 dmvs and dmfs. I created a sql server job for it via tsql with 9 steps to deployed it to the client site.

My question is to find out a way to include a version stored with the job somehow so that I know when to upgrade the job for the next deployment. Any ideas how to do that?

Thanks in Advance!


Solution

  • You can add custom properties to database objects like this:

    EXEC sp_addextendedproperty
        N'YourProperyName', N'SomeValue',
        N'SCHEMA', N'dbo',
        N'TABLE', N'MyTable'
    

    But I don't know if it works for jobs. Or maybe use Description field of a job:

    select top 10 * from msdb.dbo.sysjobs