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 React.js
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)
Find number of letter occurence of all letter in c#
Find number of letter occurence of all letter in c# namespace ConsoleApp1 { internal class Program { static void Main(st...
-
ViewBag, ViewData, TempData and View State in MVC ASP.NET MVC offers us three options ViewData, ViewBag and TempData for passing data from...
-
View in Sql Server 2008 Creates a virtual table whose contents (columns and rows) are defined by a query. Use this statement to create a vie...
-
// Export Datatable to Excel in C# Windows application using System; using System.Data; using System.IO; using System.Windows.Forms; ...

