Hi
How to remove duplicate records from a table ?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh TrivediPosted Jul 4, 2012, 11:50 PM
There are many ideas to remove duplicate record from table
Idea 1:
http://blog.sqlauthority.com/2007/03/01/sql-server-delete-duplicate-records-rows/
Idea 2:
http://support.microsoft.com/kb/139444
Idea 3:
http://www.codeproject.com/Tips/159881/How-to-remove-duplicate-rows-in-SQL-Server-2008-wh
hope this will help you.
Shen HengbinPosted Jul 4, 2012, 9:35 PM
ID NAME
1 name1
2 name2
3 name1
4 name2
And you want to get rid of the duplicate data
you can try this.
BEGIN TRAN
DELETE
FROM
WHERE EXISTS(
SELECT * FROM
WHERE
T1.NAME = T2.NAME AND
T2.ID > T1.ID
)
SELECT * FROM
ROLLBACK
Satyapriya NayakPosted Jul 4, 2012, 3:06 PM
STEP 1 - Insert your distinct data into a temporary table select distinct* into temp from TableName
STEP 2 - Delete From TableName
STEP 3 - Insert TableName Select * From temp Write three step and remove duplicate values from your tables.
Thanks
Anil KumarPosted Jul 4, 2012, 12:57 PM
Removing Duplicates from a Table in SQL Server