Hi,
Can anyone help me with the script which will delete the data older than the particular date.
Thanks
From stackoverflow
-
delete from YOUR_TABLE where your_date_column < '2009-01-01'; -
This is pretty vague. Do you mean like in SQL:
DELETE FROM myTable WHERE dateColumn < '2007' -
Delete data that is 30 days and older
DELETE FROM Table WHERE DateColumn < GETDATE()- 30 -
or an ORACLE version:
delete from table_name where trunc(table_name.date) > to_date('01/01/2009','mm/dd/yyyy')KM : question has sqlserver tagnorthpole : my bad, I read a tag of "sql", sorry -
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';
0 comments:
Post a Comment