Delete Duplicate Rows SQL Server

1. Add an Identity Column to the Table

alter table MASTER
add identity_col int identity(1,1);

2. Delete duplicate data using Below Query (In the GROUP BY CLAUSE you can specify multiple columns if the row is indetified using more than one field)

delete from MASTER where identity_col not in ( select Min(identity_col) from MASTER group by trnx_uid);


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s