how to delete duplicate rows from table in sql server

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 ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Detail about query optimizer?

617


What is query cost in sql server?

564


What are the new data types are introduced in sql 2000?

508


Can you give me some DBCC command options?(Database consistency check) - DBCC CHECKDB - Ensures that tables in the db and the indexes are correctly linked.and DBCC CHECKALLOC - To check that all pages in a db are correctly allocated. DBCC SQLPERF - It gives report on current usage of transaction log in percentage. DBCC CHECKFILEGROUP - Checks all tables file group for any damage.

2037


What is a rollup clause?

551






What is the default port for SQL Server over a firewall?

593


Is mysql better than sql server?

545


Why de-normalization required?

578


What are the benefits of normalization?

579


What is key set driven?

543


on line cluster can we make if yes tell me the procedure

1517


How to create new databases with "create database" statements?

572


what are the critical issues you have resloved in your company

1557


What is report rendering ?

102


Explain what is dbcc?

597