Saturday, April 11, 2009

Deleting Old Data from SQL Server Database Table

Here is the query to delete older data from table like 3 months old data.

select * from Tablename where Columname<dateadd(mm,datediff(mm,0,getdate())-3,0)

The below query to finding old date in the table
select min(Date_Columname) from Databasename..Tablename 



how to delete 60 days older data from the table. how to delete 90 days old data from the table. how to delete 3 months old data from the table. how to delete 6 months old data from the table. how to delete older data from the table. how to archive older data from the table. how to archive 3 months old data. how remove old data

0 comments:

Post a Comment