locked
Execute procedure with delay RRS feed

  • Question

  • When one procedure is executed, I would like, that it also executes other procedure (asynchronously), but with 30 minutes delay.
    What would be the best way to achieve this functionality?

    One way is to enable job, which will execute the second procedure after 30 minutes.

    Other way is probably with service broker and message queue? I guess this is more elegant way?
    So, insert message into queue, which will activate stored procedure, which will have WAITFOR DELAY '000:30:00' at the begining of the procedure.

    Any other idea?

    thanks,

    Simon

    Wednesday, January 23, 2013 11:01 AM

Answers

  • Service Broker would be the best deal. Rather than using WAITFOR look at conversation timers.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
    • Proposed as answer by Satheesh Variath Wednesday, January 23, 2013 11:53 AM
    • Marked as answer by simonxy Wednesday, January 23, 2013 1:02 PM
    Wednesday, January 23, 2013 11:15 AM

All replies