Home Forums SQL Server 2005 T-SQL (SS2K5) Execute a select statement continually - for instance every 5 minutes RE: Execute a select statement continually - for instance every 5 minutes

  • Found this which seems to work:

    [font="Times New Roman"]SELECT GETDATE() --your query to run

    raiserror('',0,1) with nowait --to flush the buffer

    waitfor delay '00:00:10' --pause for 10 seconds

    GO 5 --loop 5 times[/font]

    With the only issues being-

    1) It appends to the results window - would rather it overwrote

    2) No end-time, though suspect that could easily be done, or I could use simple arithmetic to run for a fixed period.