views:

141

answers:

4

Hi, I've searched all over the net for this. Hope that someone's got something.

How would a record in a database be updated automatically after x time n coldfusion?

I know how to manually do it by writing an sql that performs an action to all records older than x time based on the timestamp.

How would this be done automatically?

Kind Regards, Nich

+5  A: 

Write out the query to a new ColdFusion template, then use CFSCHEDULE to schedule a task to run that template at the appropriate time.

CFSCHEDULE docs: http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_r-s_11.html

Edward M Smith
+5  A: 

You can created a scheduled task in the ColdFusion Administrator (CFIDE) that runs a cfm script. Inside your cfm script simply write a query to update the data based on the age of the record.

John Whish
A: 

What an eye opener! Thank you!

Nich
This isn't an answer to your question, but should really be a comment on one of the other answers. If one of the answers solved your problem, please "accept" it. This site is quite a bit different than more traditional "forum" sites. You might like to read the FAQ.
Al Everett
A: 

Depending on what your purpose is, there may be other means of accomplishing what you want to do.

If you are using MS-SQL 2k5+ You could use a computed column. For instance "(CASE WHEN GetDate() <= DateAdd(hh, 1, DateCreated) THEN 'I am overdue' ELSE 'I am still waiting' END)"

Or you could create a view to do similar transformations on the data.

This may not work for what you want to accomplish, but I figured I'd post it anyway.

Tyler Clendenin