Remove duplicates in SQL Server when tables have no primary key
I have table called CricketerDetails, and the table has no primary or unique key.
Below i have mentioned how to remove duplicate items with query.
1. Procedure to remove the Duplicate rows with query is
Query
WITH tempTable as
(
SELECT ROW_NUMBER() Over(PARTITION BY FirstName,LastName,HighestScore ORDER BY FirstName) As RowNumber,* FROM CricketerDetails
)
DELETE FROM tempTable where RowNumber >1
SELECT * FROM CricketerDetails order by FirstName asc
Dotnet, DotnetCore, Azure, C#,VB.net, Sql Server, WCF, MVC ,Linq, Javascript and Jquery
Showing posts with label Remove duplicates in SQL Server when tables have no primary key. Show all posts
Showing posts with label Remove duplicates in SQL Server when tables have no primary key. Show all posts
Subscribe to:
Posts (Atom)
Implementing OAuth validation in a Web API
I mplementing OAuth validation in a Web API Implementing OAuth validation in a Web API using C# typically involves several key steps to sec...
-
ViewBag, ViewData, TempData and View State in MVC ASP.NET MVC offers us three options ViewData, ViewBag and TempData for passing data from...
-
// Export Datatable to Excel in C# Windows application using System; using System.Data; using System.IO; using System.Windows.Forms; ...