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
What does top operator do?
What guidelines should be followed to help minimize deadlocks?
How to enter comments in transact-sql statements?
What are the steps to follow to configure SQL*Net?
What happens if date-only values are provided as date and time literals?
Explain different backup plans?
What is the preferred way to create a clustered and non-clustered index? Which index should you create first the clustered or non-clustered?
Explain the steps needed to create a scheduled job?
How will you monitor replication activity and performance? What privilege do you need to use replication monitor? : sql server replication
What are the advantages of user-defined functions over stored procedures in sql server?
Can we write a distributed query and get some data which is located on other server and oracle database?
What is ssl in sql server?
What is the current limitation of the size of SQL Azure DB?
How much memory that we are using in Logshipping Concept?
Explain what is “asynchronous” communication in sql server service broker?