Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL 2008 R2 - Time-Based Triggers?

Is it possible to have a stored procedure or set of SQL code run periodically by specifying a time-based trigger in SQL Server?

like image 529
Brian Webster Avatar asked Dec 13 '22 14:12

Brian Webster


2 Answers

Not directly, but look at SQL Jobs.

A job is a specified series of operations performed sequentially by SQL Server Agent. A job can perform a wide range of activities, including running Transact-SQL scripts, command-line applications, Microsoft ActiveX scripts, Integration Services packages, Analysis Services commands and queries, or Replication tasks. Jobs can run repetitive tasks or those that can be scheduled, and they can automatically notify users of job status by generating alerts, thereby greatly simplifying SQL Server administration.

(emphasis mine)

like image 186
Oded Avatar answered Dec 30 '22 20:12

Oded


You can use a SQL Agent job. IF you have a requirement to run on Express editions, that lack SQL Agent, you can use dialog timers and activation.

like image 35
Remus Rusanu Avatar answered Dec 30 '22 20:12

Remus Rusanu