Can anyone help me with the script which will delete the data older than the particular date.
Thanks
Can anyone help me with the script which will delete the data older than the particular date.
Thanks
delete from YOUR_TABLE where your_date_column < '2009-01-01';
This will delete rows from YOUR_TABLE where the date in your_date_column is older than January 1st, 2009. i.e. a date with 2008-12-31 would be deleted.
Delete data that is 30 days and older
DELETE FROM Table
WHERE DateColumn < GETDATE()- 30
You could use:
DELETE FROM tableName
where your_date_column < '2009-01-01';
but Keep in mind that the above is really
DELETE FROM tableName
where your_date_column < '2009-01-01 00:00:00';
Not
DELETE FROM tableName
where your_date_column < '2009-01-01 11:59';
This is pretty vague. Do you mean like in SQL:
DELETE FROM myTable
WHERE dateColumn < '2007'
or an ORACLE version:
delete
from table_name
where trunc(table_name.date) > to_date('01/01/2009','mm/dd/yyyy')