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
 General SQL Server Forums
 New to SQL Server Programming
 SQL Agent job

Author  Topic 

pravin14u
Posting Yak Master

246 Posts

Posted - 2008-08-22 : 15:46:51
Hi All,

I need to implement a job which will check for a flag to execute a package. This job should be polling(trying to execute) every one minute to see if the falg is swiched ON. Once ON, it should execute the package once and should not try executing again.

Is there a possibility achieve this using the schedule options in SQL agent?

Prakash.P
The secret to creativity is knowing how to hide your sources!

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-08-22 : 15:49:25
Yes, where will the flag be stored?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

pravin14u
Posting Yak Master

246 Posts

Posted - 2008-08-22 : 15:52:46
The first step of my package has the logic to check for flag. So if the flag is FALSE, it wont go to the next step and package gets terminated.

If I use recurrance at the day level, there is a chance that the package might get executed for the 2nd time(assuming the 1st execution completes and the polling is still going on)

Prakash.P
The secret to creativity is knowing how to hide your sources!
Go to Top of Page

pravin14u
Posting Yak Master

246 Posts

Posted - 2008-08-22 : 15:53:52
quote:
Originally posted by tkizer

Yes, where will the flag be stored?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog




It is stored in a table.

Prakash.P
The secret to creativity is knowing how to hide your sources!
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-08-22 : 16:39:52
Then read the table in a job step.

IF (SELECT ...)
EXEC master.dbo.xp_cmdshell 'dtsrun ...'

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

pravin14u
Posting Yak Master

246 Posts

Posted - 2008-08-22 : 17:00:55
Thanks, I have one more question on SQL Server Agent jobs.

Say I have a schedule which runs every ten mins and for some reason the first schedule runs for more than 10 mins. What will happen to the next schedule? Will the next one get executed after the current one finishes or will it get aborted?


Many thanks!

Prakash.P
The secret to creativity is knowing how to hide your sources!
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-08-22 : 17:01:52
It'll skip to the next run date.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -