All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Nadir
Posts: 264 Joined: Mon Aug 29, 2005 2:01 am
Post
by Nadir » Fri May 26, 2006 4:16 am
Hi all,
Have you an idea to purge table with sql query?
I want to delete the last 6 months records with sql query like this
DELETE FROM table
WHERE DateTime < 'current datetime - 6 mounths'
Thanks for help
KS-Soft Europe
Posts: 2832 Joined: Tue May 16, 2006 4:41 am
Contact:
Post
by KS-Soft Europe » Fri May 26, 2006 4:51 am
Nadir wrote: I want to delete the last 6 months records with sql query like this
DELETE FROM table
WHERE DateTime < 'current datetime - 6 mounths'
Do you mean to leave only the last 6 months, don't you? I suppose you want to leave last 6 months data and delete older records, right?
As I remember, you have used MS SQL? Correct? Then you should use Transact SQL Syntax. E.g.
DELETE FROM table
WHERE DateDiff(mm,DateTime,GetDate()) > 6
http://msdn.microsoft.com/library/defau ... b_5vxi.asp
But before exucuting such query, I recommend you to replace "Delete" sentence with "Select * " to ensure the correct data would be deleted
Regards,
Max
Nadir
Posts: 264 Joined: Mon Aug 29, 2005 2:01 am
Post
by Nadir » Fri May 26, 2006 6:00 am
I suppose you want to leave last 6 months data and delete older records, right?
Yes you have right
Thanks Max