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
What happens if date-only values are provided as date and time literals?
What is the sql server 2000 version number?
Explain ranking functions?
What is SQL Azure?
Write a Select Query to display title for each group of records, which are collected with Compute Clause? Like titlefield column-A column-B ..... ..... ..... Sum ... titlefield column-A column-B ..... ..... ..... Sum ...
How to use go command in "sqlcmd"?
What are the different types of collation sensitivity?
Explain DBCC?
Explain how you can deploy an SSRS report?
What is a collation in ms sql server?
How to delete existing rows in a table?
as a general practice, it is recommended to have dbo be the owner of all database objects however, in your database you find number of tables owned by a user other than dbo, how could you fix this? : Sql server administration
Do you know what are the restrictions that views have to follow?
Write a SQL query to make a column as unique?
How to encrypt data between dialogs?