SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Managing Jobs Using TSQL


Managing Jobs Using TSQL

Author
Message
Randy_Dyess
Randy_Dyess
SSC-Enthusiastic
SSC-Enthusiastic (186 reputation)SSC-Enthusiastic (186 reputation)SSC-Enthusiastic (186 reputation)SSC-Enthusiastic (186 reputation)SSC-Enthusiastic (186 reputation)SSC-Enthusiastic (186 reputation)SSC-Enthusiastic (186 reputation)SSC-Enthusiastic (186 reputation)

Group: General Forum Members
Points: 186 Visits: 1
Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/RDyess/managingjobsusingtsql.asp



David Lu
David Lu
Old Hand
Old Hand (390 reputation)Old Hand (390 reputation)Old Hand (390 reputation)Old Hand (390 reputation)Old Hand (390 reputation)Old Hand (390 reputation)Old Hand (390 reputation)Old Hand (390 reputation)

Group: General Forum Members
Points: 390 Visits: 135

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
David Lu
Old Hand
Old Hand (390 reputation)Old Hand (390 reputation)Old Hand (390 reputation)Old Hand (390 reputation)Old Hand (390 reputation)Old Hand (390 reputation)Old Hand (390 reputation)Old Hand (390 reputation)

Group: General Forum Members
Points: 390 Visits: 135

One thing:

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

-D





thepunisher9
thepunisher9
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 8
Have you updated this routine to work on SQL Server 2005?



Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search