how to delete duplicate rows from table in sql server

Answer Posted / vineet dhamija

the best approach i came across in simple form too
just create a temporary table with the distinct values and
truncate this table than copy the values back and u r good to go
select distinct * into #temp from urtable
truncate table urtable
insert into urtable select * from #temp
drop table #temp

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do we use sql limitations? Which constraints can we use while making a database in sql?

565


What is a mutating table error and how can you get around it?

541


Explain can SSRS reports Cache results?

112


What is use of attribute hierarchy optimized state? : sql server analysis services, ssas

589


How to use wildcard characters in like operations in ms sql server?

607






What is the native system stored procedure to execute a command against all databases?

545


When should you use an instead of trigger?

560


How many columns can exist together per table?

713


How to maintain a fill factor in existing indexes?

533


List out the differences between global and local temp tables in sql server?

580


Explain the various types of concurrency problem?

705


What is the rdl file?

88


What is the size of transaction log file?

492


Why do you need a sql server?

511


Explain how you can deploy an SSRS report?

106