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 is a fill factor?

627


Stored Procedure returns data from multiple tables. How to access it in your ASP.Net code?

553


where the connection string store in the database

1529


Explain the advantages of merge replication?

514


Describe in brief authentication modes in sql server.

567






Does group by or order by come first?

542


When setting replication, is it possible to have a publisher as 64 bit sql server and distributor or subscribers as a 32 bit sql server?

499


What is the significance of master, tempdb and model databases?

526


What is explicit mode in sql server?

534


How to change a login name in ms sql server?

562


How do I delete a sql server database?

549


What do you mean by 'normalization'?

606


Does an index slow down updates on indexed columns?

581


What is the optimization being performed in oracle and SQL Server?

630


How to delete duplicate rows from table except one?

545