Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
sirrahhc
Starting Member
2 Posts |
Posted - 2010-04-07 : 09:58:50
|
| Hey guys, how's it going?? I'll be honest, I'm terrible when it comes to loops...so with that said, here's what I would like to accomplish. I ran a query to get all of the reports that run at a certain time from the sys.jobs table and dropped those values into a temp table (tmpJobs). The field that denotes the jobs is called NAME. I would now like to loop through that table and run the sp_start_job for every NAME value in the tmpJobs table. The below code will run the sp_start_job for the one record from the sys.jobs table but I would instead like to loop through my tmpJobs table and run sp_start_job for all values in that table. Any suggestions?? Thanks in advance!!!!!declare @x varbinary(1000)select @x= job_id fromMSDB.dbo.sysjobs where name = '9AF35912-DDCB-4F09-B1E5-D68A93BF508C'exec msdb..sp_start_job @job_id = @xChris Harris |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
sirrahhc
Starting Member
2 Posts |
Posted - 2010-04-09 : 09:16:29
|
| Cool, thanks madhivanan!! This looks pretty close to what I want to do...Chris Harris |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-04-09 : 09:39:35
|
quote: Originally posted by sirrahhc Cool, thanks madhivanan!! This looks pretty close to what I want to do...Chris Harris
You are welcome MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|