July 30, 2021 at 5:16 am
Hi,
Is there a way for monitoring data in a table and update it when it exists in the table longer than a period of time?
For example, a table has a column called "measure", if the column contained value > 0 longer than 15 minutes then update it to be 0.
Any help would be appreciated.
Regards,
KL.
July 30, 2021 at 11:00 am
Write a batch that periodically checks new items based on a timestamp? Do the records have a modified timestamp? (better to check on one column)
July 30, 2021 at 11:36 am
Yeah, total agreement with Jo. It's just a question of probing the table on a regular basis to see what the status is. There is no such thing as a time trigger within SQL Server. Instead, you use an external scheduler like SQL Agent or something else. Run a query every fifteen minutes. In that query, don't even do a check and then an update. Just do an update where the criteria matches. Single batch statement and done.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply