Friday, September 7, 2012

How to remove duplicate rows in SQL Server




delete from dbo.tblSalary
           where emp_salary in(
                  select emp_salary as [Salary Result] from dbo.tblSalary
                                    group by emp_salary
                                    having count(emp_salary)>1)

Noted point: dbo.tblSalary =Table-Name”
      emp_salary = “Column-Name”