Thursday, April 21, 2011

SQL Server 2005 Job Schedule

Can we schedule a Stored Procedure to run every 3 seconds in SQL server 2005 ? I could not find a way to schedule it so currently i am calling from front-end. The schedular interface allow minimum 1 minute of scheduling.

From stackoverflow
  • I dont know about run shcedule every 3 seconds, but you can write in step multiple invokes of your procedure with waitfor procedure:

    WAITFOR DELAY '00:01'
    
    Manjoor : X2, It is great. so what is the best way WHILE TRUE BEGIN WAITFOR DELAY '00:03' EXECUTE @n = dbo.WorkerSP END
  • You can schedule it every minute to run 20 times in a loop with waitfor delay 3 seconds. Or even to run continuously in a loop with 3 second waitfor delays.

    In SQL 2005 and on you can use Conversation Timers to launch activated procedures at 1 second resolution timer.

    On a side note, I highly doubt such scheduling is ever necessary.

    John Sansom : +1:That's an interesting solution, although I also agree with your final point.
    Manjoor : Rusanu, Thanks for your response. it is a real world need to call it every 3 secodns. the application is ruuning fine. i just want to do it in background so i do not need to run a exe to call it.

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.