Ask a Question related to Coldfusion Database Access, Design and Development.
-
Flog #1
Auto delete records
I have an Events Calendar application that I want to automate a bit more. I
need a way to have coldfusion delete a record if its "Expiry date" is past
today's date.
I have tried a conditional statement with limited success.
Any ideas would be welcomed.
Flog Guest
-
Why can't I delete these records?
Hi all! When I do: SELECT COUNT(*) AS counter FROM table1 WHERE condition1 = 'A' AND condition2 IS NULL; it returns: +---------+ | counter... -
Delete records
Hi, I have produced a page used a webthang tutorial ?Deleting Multiple Records Using Checkboxes by Rob Boyle? to delete records.... -
Auto Add/Delete Bugs
1) Position the Pen cursor over a pre-existing point of a selected path.The (infernal, despised) auto-delete Pen cursor appears. 2) Press Shift.... -
HELP! Have large db. Need to delete all records.
Client are 6 Server is 5.0 win2k server win2k& xpclients I have a large fmpro DB but cannot delete all the records to start new. I want to... -
Cannot delete records in Subform.
I am unable to delete records within a subform (continuous) when I have it open in another form. If I open the subform on it's own, I am able to... -
Dan Bracuk #2
Re: Auto delete records
delete from thetable
where expirydate <= current_date
the current_date part is database specific. You should know what it is for
your database. If this is not available in your datebase, you could always use
the appropriate dateformat on the cf now function
delete from thetable
where expirydate <= #d 'datefomat(now(), "yyyy-mm-dd")'}#
Originally posted by: Flog
I have an Events Calendar application that I want to automate a bit more. I
need a way to have coldfusion delete a record if its "Expiry date" is past
today's date.
I have tried a conditional statement with limited success.
Any ideas would be welcomed.
Dan Bracuk Guest
-
mxstu #3
Re: Auto delete records
> delete a record if its "Expiry date" is past today's date
As mentioned the exact syntax may depend on what type of database, column
type, and/or connection you're using.
Assuming "ExpiryDate" is a date/time column, if today is "10/29/2005"
something like the attached query should work. It would delete all records with
a date of 10/28/2005 or earlier (10/27/2005, 10/26/2005, etc...)
NOTE: You might consider updating a "flag" column (is. "IsDeleted" instead of
actually deleting the records. Especially if your events have related records
in other tables.
DELETE FROM yourTable
WHERE ExpiryDate < #CreateODBCDate(now())#
mxstu Guest



Reply With Quote

