Reputation: 314
I am currently makin a web application in asp.net. where I want to delete all records from database which is older than 1 month. how can I delete them on server side by running any type of script. or any other type of suggestion which I useful in my scenario. thanks and sorry I am new to web development and forgive me if I a asking blunder.
Upvotes: 1
Views: 55
Reputation: 8113
The sql query would be something like this;
DELETE FROM TableName
WHERE DateField < DATEADD(mm,-1,GETDATE())
You'd have to do it at a table level, you can't do it for a whole database as each table is likely to have different fields in a different order.
Upvotes: 1