Can anyone help me with the script which will delete the data older than the particular date.
Thanks
This question is related to
sql-server
or an ORACLE version:
delete
from table_name
where trunc(table_name.date) > to_date('01/01/2009','mm/dd/yyyy')
Delete data that is 30 days and older
DELETE FROM Table
WHERE DateColumn < GETDATE()- 30
This is pretty vague. Do you mean like in SQL:
DELETE FROM myTable
WHERE dateColumn < '2007'
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';
Source: Stackoverflow.com