Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete records older than Date 1

Status
Not open for further replies.

Gryphon4200

Technical User
May 13, 2008
2
US
I have a sales history table in salehist.dbf created in FoxPro 2.0. In this table is a column Entry which is of type Date.

I am trying to do something like:

DELETE ALL FOR ENTRY < DATE(01/01/00)

But every time I try I either get some type of mismatch error or in the case of trying:

DELETE ALL FOR ENTRY < {01/01/00}

It appears to work but deletes 0 records.
Any help with this would grateful.
 
Thank you for pointing out that I'm an idiot!...

Anyway.. that worked like a charm.

Thanks for all your help.
 
Hi NewProgrammer:

One more caution is to make a backup before deleting records, such as
* Check the date format
set century on
use mytable
copy to t_20080514 && extra line to Backup
DELETE FOR ENTRY < {01/01/2000}

* After verification you could delet the backup file.
 

Gryphon4200,

You don't really need to know the layout of the date you have.

You get mismatch error because you use DATE() function incorrectly.

If you use it like this:

DELETE ALL FOR ENTRY < DATE(2000, 1, 1)

or, generally speaking,

DELETE ALL FOR ENTRY < DATE(year, month, day)

then you don't need to check SET("DATE") to determine the layout of the date.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top