开发者

Getting SQL Server to perform a stored proc based on a timer?

开发者 https://www.devze.com 2023-01-07 22:02 出处:网络
I\'m not a DBA by any means, but i need my SQL Server to perform \"checks\" everyday (say at midnight)

I'm not a DBA by any means, but i need my SQL Server to perform "checks" everyday (say at midnight)

They're pretty simple (I think), e.g. - if a particular row's dateTime has passed, I'd like to delete that 开发者_如何学Crow and set the column in the reference table to NULL

Is this a database trigger?

Any sample code or links would be greatly appreciated.


You would typically use a SQL Server Agent Job for this. Unless you are on an express edition where this is not available?

For express editions you could either use the windows task scheduler or perhaps look at the workaround approach here using Service Broker.


This is a Maintenance Plan (or SQL Agent Job, as Martin said):

http://msdn.microsoft.com/en-us/library/ms187658.aspx

(Assuming your MS-SQL server is new enough to support that)

Otherwise, you can use Task Scheduler in the Windows system to create a scheduled task that will do what you want.

0

精彩评论

暂无评论...
验证码 换一张
取 消