CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Simple Delete old records code needed

Print topic Send  topic

Author Message
stookie

Posts: 5
Posted: 08/01/2008, 6:15 AM

Hi Forum

I am trying to get the code that will delete records that have a date field older than 2 days from today's date.

The code I have been trying to use is:
DELETE FROM k-events WHERE date_start < date() -2

I have been searching around the forum and tried several variations this code... just cant get it to work!.

I know it's just a simple code but just cant get it.

Any help on this matter would be appreciated, Thanks
View profile  Send private message
Oper


Posts: 1195
Posted: 08/02/2008, 8:43 AM

Database?

generic:
DELETE FROM Table WHERE datediff(date1,date2) < 2 (or whatever)

function datediff may vary from one database to another
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)

http://www.PremiumWebTemplate.com
Affiliation Web Site Templates

Please do backup first
View profile  Send private message
Tuong Do
Posted: 09/07/2008, 9:29 PM

For Microsoft Access
DELETE FROM k-events WHERE date_start < DaysAdd(day , -2 , date() )
For MS SQL
DELETE FROM k-events WHERE date_start < DaysAdd(day , -2 , getdate() )



"stookie" <stookie@forum.codecharge> wrote in message
news:648930c8b61458@news.codecharge.com...
> Hi Forum
>
> I am trying to get the code that will delete records that have a date
> field
> older than 2 days from today's date.
>
> The code I have been trying to use is:
> DELETE FROM k-events WHERE date_start < date() -2
>
> I have been searching around the forum and tried several variations this
> code... just cant get it to work!.
>
> I know it's just a simple code but just cant get it.
>
> Any help on this matter would be appreciated, Thanks
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>


Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.