Reputation: 8507
How to delete all records from a table that have not been updated or created since a specified date-time via a query? This for both SQL Server 2008 and Oracle.
Upvotes: 1
Views: 135
Reputation: 10882
While I agree there isn't a magic solution as pointed out in comments. There may be a way to potentially accomplish what you need. If you have a backup of your database that corresponds to the date and time in mind you could restore that backup to a seperate database and then do some comparisons.
You could use SSIS to script up some tasks to compare data and delete under your criteria. There are also a variety of 3rd party tools such as RedGate and Idera that do data comparisons between two seperate databases.
The Merge statement gives you options on matching and non matching data and could be used in joins to provide instructions (such as delete) when exact row versions are found.
I get that you were hoping for a simple query to accomplish what you're needing but a little thinking outside the box may still help you get what you need.
All of this however requires that you have a backup from the date/time in question.
Upvotes: 3