Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Other SQL Server 2008 Topics
 Trigger an event after delay

Author  Topic 

Jamal MELLAL
Starting Member

1 Post

Posted - 2013-12-22 : 11:20:46
I have a table "TClaim" in SQL Server with the following structure:

idclaim, date_claim, state,
example:
1 | 12/22/2013 | declared

I want to set up an event that fires after the expiration of a delay of 15 days from the date of claim without processing the claim by a user (value of the "state" column changes to "treated" if it is treated).

the event is to change the value of the "state" column in "critical" for example.

What can you suggest?

thank you

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-12-22 : 13:20:26
you can create a sql server agent job for this. It will have a step which will execute a t-sql update statement for changing the state value. It will be scheduled daily and what it does would be something like below

UPDATE TClaim
SET [state] = 'Critical'
WHERE [state] = 'declared'
AND date_claim < DATEADD(dd,DATEDIFF(dd,0,GETDATE()),-15)


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -