Can anyone help me with the script which will delete the data older than the particular date.
Thanks
Deleting rows based on another table. Sometimes we need to delete rows based on another table. This table might exist in the same database or not. We can use the table lookup method or SQL join to delete these rows.
TRUNCATE TABLE is functionally identical to DELETE statement with no WHERE clause: both remove all rows in the table. But TRUNCATE TABLE is faster and uses fewer system and transaction log resources than DELETE.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With