When running the following SQL statements, I get the same results.
Though I need to count only -30 days. Both statements below also consider the time of the day as well, which is not desired
DELETE FROM MNT_R
WHERE MNT_R.TIMESTAMP < GETDATE()- 30
DELETE FROM MNT_R
WHERE MNT_R.TIMESTAMP < DATEADD(d, -30, GETDATE())
Here is the format of the values in column
MNT_R.TIMESTAMP
2005-08-09 06:06:44.577
2005-08-09 06:06:46.810
2005-08-09 06:06:49.060
So, since data are inserted into the MNT_R table every few seconds, my delete statement will delete different number of rows, according to the time of the day it runs.
thanx a lot all
Though I need to count only -30 days. Both statements below also consider the time of the day as well, which is not desired
DELETE FROM MNT_R
WHERE MNT_R.TIMESTAMP < GETDATE()- 30
DELETE FROM MNT_R
WHERE MNT_R.TIMESTAMP < DATEADD(d, -30, GETDATE())
Here is the format of the values in column
MNT_R.TIMESTAMP
2005-08-09 06:06:44.577
2005-08-09 06:06:46.810
2005-08-09 06:06:49.060
So, since data are inserted into the MNT_R table every few seconds, my delete statement will delete different number of rows, according to the time of the day it runs.
thanx a lot all