I want to keep a table as history and replace it with an empty one. How can I do this through Management Studio?
To select duplicate values, you need to create groups of rows with the same values and then select the groups with counts greater than one. You can achieve that by using GROUP BY and a HAVING clause.
A simple way is to open SSMS and Right click on database and go to Tasks > Import Data and follow the wizard to set source and destination.
Duplicate your table into a table to be archived:
SELECT * INTO ArchiveTable FROM MyTable
Delete all entries in your table:
DELETE * FROM MyTable
Don't have sql server around to test but I think it's just:
insert into newtable select * from oldtable;
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