How to delete duplicate records from a table?(for suppose in
a table we have 1000 Records in that we have 200 duplicate
Records , so ,how to findout that duplicate Records , how to
delete those Records and arranged into sequence order? one
more thing that there is no primary key at all)

Answer Posted / smitha

;with empctc(empid,ename,sal,deptid,ranking)
as
(Select empid,ename,sal,deptid,ranking=Dense_rank() over (
partition by empid,ename,sal,deptid order by NEWID() asc)
from emp
)
delete * from empctc where ranking>1

Is This Answer Correct ?    2 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What happens when the SQL Azure database reaches Max Size?

90


Detail about query optimizer?

624


You have several tables, and they are joined together for querying. The tables contain both clustered indexes and non clustered indexes to optimize performance, how should you distribute the tables and their indexes onto different file groups?

563


Explain the xml support sql server extends?

634


Do you think BCNF is better than 2NF & 3NF? Why?

803






What is an indexing strategy?

543


how you can move data or databases between servers and databases in sql server? : Sql server administration

493


What is sql server english query?

551


How to delete duplicate rows from table except one?

553


What are different types of join?

773


Can a trigger be created on a view?

579


What are the advantages dts has over bcp?

543


What are the new features of sql server 2012 reporting service?

84


Explain important index characteristics?

566


What is transactional replication?

565