Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-07-2002, 02:34 PM   PM User | #1
dawilis
Regular Coder

 
Join Date: Jul 2002
Location: Bunbury W.A
Posts: 157
Thanks: 0
Thanked 0 Times in 0 Posts
dawilis is an unknown quantity at this point
How to delete record after x days

Any one suggest how I get my code to automatically delete all records in the d/b that are older than x days, and how should I implement this code in my site? ie where would this code be inserted?
Or should I just filter the records by date and let them all build up in the database?
dawilis is offline   Reply With Quote
Old 08-07-2002, 05:11 PM   PM User | #2
ecnarongi
Regular Coder

 
Join Date: Jun 2002
Location: Northern NJ
Posts: 401
Thanks: 0
Thanked 1 Time in 1 Post
ecnarongi is an unknown quantity at this point
How are you keeping track of how old a record is? By a seperate field? if so you can use 'Now()' which is today's date and if a date is older than X days old call your delete routine.

use:

DateDiff("d", nameofrecord, Now())

which gives you back a number and if that number is greater than or equal to the number X days delete that entire record

if you need me to give code I will, but I don't think I need to
__________________
true lies
ecnarongi is offline   Reply With Quote
Old 08-08-2002, 12:17 AM   PM User | #3
dawilis
Regular Coder

 
Join Date: Jul 2002
Location: Bunbury W.A
Posts: 157
Thanks: 0
Thanked 0 Times in 0 Posts
dawilis is an unknown quantity at this point
where we put code

Ok thats helpfull, thanks, where exactly would one insrt this code in regards to the entire site? I dont want to compamise speed on the front page, is there a way of automatically calling a routine based on time of DAy? say have a seperate page run automacally every day.
dawilis is offline   Reply With Quote
Old 08-08-2002, 08:27 AM   PM User | #4
raf
Master Coder


 
Join Date: Jul 2002
Posts: 6,589
Thanks: 0
Thanked 0 Times in 0 Posts
raf will become famous soon enoughraf will become famous soon enough
Yes it is.
See the thread : schedduling executions.
raf is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:17 PM.


Advertisement
Log in to turn off these ads.