Delete duplicate records from a SQL table without a primary key

If we need to Delete duplicate records from a SQL table without a primary key then we can do with many ways. please try below statements 

1st:

DELETE SUB FROM
(SELECT ROW_NUMBER() OVER (PARTITION BY EmpId, EmpName, EmpSSN ORDER BY EmpId) cnt
 FROM Employee) SUB

WHERE SUB.cnt > 1

2nd:

With duplicates
As
(Select *, ROW_NUMBER() Over (PARTITION by EmpID,EmpSSN Order by EmpID,EmpSSN) as Duplicate From Employee)
delete From duplicates
Where Duplicate > 1 ;



These Statements will update Table and remove all duplicates from the Table!

Why we can't execute a stored procedure from a User Defined function(UDF)

Functions cannot "touch" any database but read them only. Stored procedures can do anything and everything with databases. You ...