how to delete duplicate rows from table in sql server
Answer Posted / sanjay kumar dinda
Deletion of Rows depends upon the different condition...
Consider based on n columns the entire recordset is
treating a duplicate... We can delete the duplicate by
using following method...
Add one column and set uniue values to that column..
ALTER TABLE TABLE1 ADD ID INT IDENTITY(1,1)
COnsider T contains 40 columns and based on C1,C2,C3 we
have to find the duplicate and we have to delete the same...
Delete T1
FROM TABLE1 T1,TABLE1 T2
WHETE T1.C1=T2.C1 AND
T1.C2=T2.C2 AND
T1.C3=T2.C2
AND T1.ID>T2.ID
I think this will help....
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How to restore performance issues and how to check?
What is difference between rollback immediate and with no_wait during alter database?
Where is localdb stored?
What is full outer join in sql server joins?
What factors you will consider calculating the storage requirement for that view?
Why is there a performance difference between two similar queries where one uses union and the other uses union all?
What is a benefit of using an after insert trigger over using a before insert trigger?
What is the optimization being performed in oracle and SQL Server?
hi, the following are the outputs of sp_spaceused and sp_tempdbspace sp_spaceused ------------ database size unallocated size tempdb 77752.95 MB 28026.99 MB sp_tempdbspace ------------- database size spaceused tempdb 77752.945312 1.007812 the unused space in sp_spaceused is nearly 28 Gb and in sp_tempdbspace is nearly 76 Gb cany any one explain about this output and why its giving different results.
What are ddl (data definition language) statements for tables in ms sql server?
What is the use of nvl work?
What are the security related catalog views? : sql server security
What is the difference between rank and dense_rank?
How do I create a trace in sql server?
Is ssrs support other database except ms sql server?