I have a table EMP in which the values will be like this

EmpId Ename Sal DeptId
11 Ram 10000 10
11 Ram 10000 10
22 Raj 20000 20
22 Raj 20000 20
33 Anil 15000 30
33 Anil 15000 30

I want to delete only duplicate Rows. After Delete I want
the output like this

EmpId Ename Sal DeptId
11 Ram 10000 10
22 Raj 20000 20
33 Anil 15000 30



Answer Posted / vikas kant

select Distinct * into #Temp_Temp1 from Emp
truncate table Emp
insert into Emp select * from #Temp_Temp1
select * from Emp

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Do you know what are pages and extents? : SQL Server Architecture

732


What is difference between sql and sql server?

689


Explain the difference between control flow and data flow?

698


Explain about link server in sql server?

734


How to install sql server 2005 express edition?

792






how to avoid cursors? : Sql server database administration

652


What are the new features introduced in SQL Server 2000 (or the latest release of SQL Server at the time of your interview)? What changed between the previous version of SQL Server and the current version?

802


What are the differences between having and where clause.

707


Which Model uses the SET concept

743


What does COMMIT command do?

768


What is difference between standardization and normalization?

733


What is raid? : SQL Server Architecture

805


Is sql server implemented as a service or an application? : Sql server database administration

698


What are the restrictions that views have to follow?

718


How to find the service pack installed? : sql server database administration

769