Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > DB-Aware

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 10-26-2010, 11:34 AM
Bakaner Bakaner is offline
Junior Member
 
Join Date: Nov 2003
Posts: 10
Question Deleting Record According to Date

Hi,

I have to delete records from a dBase file according to the 'Date' field. I must read the 'Date' field, compare it with the current date and if it is older than 5 years i will delete the records. I did it at year base but i must make it at day and month level sensitivity.

What can i do?

Thanks for any help from now.
Reply With Quote
  #2  
Old 10-26-2010, 01:17 PM
Norrit Norrit is offline
Moderator
 
Join Date: Aug 2001
Location: Landgraaf
Posts: 7,333
Default

In MSSQL it would look like:
Code:
SELECT * FROM [atable]
WHERE (DateAdd(dd,(DateDiff(dd,0,DateAdd(Year,-5,GetDate()))),0) <= DateAdd(dd,(DateDiff(dd,0,[adatetimefield])),0))
I'm not familiar with dbase, but perhaps it looks the same there...
Reply With Quote
  #3  
Old 10-26-2010, 01:59 PM
Bakaner Bakaner is offline
Junior Member
 
Join Date: Nov 2003
Posts: 10
Default

Thank yo very much.
Reply With Quote
Reply

Tags
date, day, delete, month, record

Thread Tools
Display Modes

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. The time now is 04:40 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.