Managing Jobs Using TSQL

  • Randy_Dyess

    SSC Eights!

    Points: 964

    Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/RDyess/managingjobsusingtsql.asp

  • David Lu

    SSC Eights!

    Points: 882

    Excellent. I have the similar situation of handling about 80 above servers. You script of join sj and sh solve most of my delima of checking server by server and consolidate all into one table.

    I made following changes:

    1. declare @daydiff int           select @daydiff = 1 'in case I am only interested in last night job

     where cast(left(cast(run_date      as char(8)), 4)    as int)= datepart(yyyy, getdate())

       and cast(substring(cast(run_date as char(8)), 5, 2) as int)= datepart(month,getdate())

       and cast(right(cast(run_date     as char(8)), 2)    as int)= datepart(day,  getdate()-@dayDiff)

       and sh.step_name <> '(Job outcome)'

    2. I filtered out the step_name = '(Job outcome)'

    3. I union all servers

    4. Finally, I create 2 cursor loops to find any existing databases on 80 servers either missing the job set up or with failure status. It works great in either case.

    thanks

    -D

     

  • David Lu

    SSC Eights!

    Points: 882

    One thing:

    why the name of sj and sh data type are sysname? which causes centain problems in datalength() function...

    -D

  • thepunisher9

    Grasshopper

    Points: 13

    Have you updated this routine to work on SQL Server 2005?

Viewing 4 posts - 1 through 4 (of 4 total)

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