SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Other SQL Server 2008 Topics
 Trigger an event after delay
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Jamal MELLAL
Starting Member

Morocco
1 Posts

Posted - 12/22/2013 :  11:20:46  Show Profile  Reply with Quote
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

India
52249 Posts

Posted - 12/22/2013 :  13:20:26  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000