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 save transaction and save point?

620


Tell me when is the update_statistics command used?

504


What is an execution plan?

563


Explain primary key, foreign key and unique key?

534


What is the difference between Normalization and De-normalization?

556






What is user-defined functions? What are the types of user-defined functions that can be created?

559


Explain about nested stored procedure?

594


How many types of the database links?

596


Can sql server 2016 run on windows 7?

500


What is multilevel indexing?

527


In what three ways is the return statement used in a stored procedure?

514


Which joins are sql server default?

502


Explain the dbcc pintable command when would you use it?

503


Explain tables in SQL Azure?

94


Call by value and call by reference in procedure and function, with NOCOPY.

830