DEV Community

Saravanan Muniraj
Saravanan Muniraj

Posted on

1

Eliminate duplicate values in a table

In SQL server, the "PARTITION BY" clause is utilized to divide a result set into partitions depending on the values of one or more columns. This feature can be employed to eliminate duplicate values in a table.

WITH CTE AS
(
SELECT *,ROW_NUMBER() OVER (PARTITION BY Column_Name ORDER BY Column_Name ) AS RN
FROM Table_Name
)

DELETE FROM CTE WHERE RN<>1

Top comments (0)

Image of Bright Data

Maintain Seamless Data Collection – No more rotating IPs or server bans.

Avoid detection with our dynamic IP solutions. Perfect for continuous data scraping without interruptions.

Avoid Detection

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay