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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Job Schedules - Getting moment's jobs

Author  Topic 

baranozgul
Starting Member

20 Posts

Posted - 2004-02-21 : 18:56:36
Hi,

I am trying to build a job scheduling system of my own, for my application. I am inspired by msdb database and Sql Server Agent job handling.

I examined sysjobs and sysjobschedules tables, It is now clear for me to encode a schedule into sysjobschedules table. I have no problem with the usage and meaning of table fields.

However, I am really curious about how SQL server Agent decides if there are jobs to do, at a specific moment. That is, how sql server agent decodes the info in sysjobschedules.

For example does it query all the table every minute? If so with what kind of a T-SQL query? or does each schedule create a timer like thread in the memory? Or anything else? Any ideas?

Sincerely
Baran OZgul

robvolk
Most Valuable Yak

15732 Posts

Posted - 2004-02-21 : 19:06:29
You can run SQL Profiler to see if SQL Agent does any kind of checking like you describe, but I think it simply loads the schedule data up whenever it starts, or whenever a job is added or modified.

Also, if you're thinking of piggybacking your application's schedule data into the msdb tables, don't do it. Either create them as real SQL Server jobs, or create completely separate tables in another database. Modifying the system databases and tables can be very dangerous and it's generally more risk than it's worth.
Go to Top of Page

baranozgul
Starting Member

20 Posts

Posted - 2004-02-21 : 19:17:35
Thanks robvolk,

I am just examining the system, I will create my own tables as a result.

I had checked with SQL Profiler before, but SQL agent entries in the Profiler log are rather demo related performance counter queries.

So you believe that once SQL Agent starts or refreshes., it grabs the schedule info into memory, and does the interpretation?
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2004-02-21 : 19:29:30
Have a look at
http://www.nigelrivett.net/Scheduler.html


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -