﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2005 / SQL Server 2005 General Discussion  / Deleting Duplicate Record in Production / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Sat, 25 May 2013 04:47:02 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Deleting Duplicate Record in Production</title><link>http://www.sqlservercentral.com/Forums/Topic976256-149-1.aspx</link><description>[b]After following the suggestion by [/b]PaulB-TheOneAndOnly [quote][b]First you do it in a test database, once validated you go for production[/b][/quote]You can use a CTE something like:[code="sql"];with numbered as(SELECT rowno=row_number() over  (partition by PRODUCTID, Customerid order by PRODUCTID),PRODUCTID,CustomerId from PartDemo)  select * from numbered[/code]You can change the select statement to DELETE WHERE rowno &amp;gt; 1To repeat:[quote][b]First you do it in a test database, once validated you go for production[/b][/quote]</description><pubDate>Fri, 27 Aug 2010 12:24:23 GMT</pubDate><dc:creator>bitbucket-25253</dc:creator></item><item><title>RE: Deleting Duplicate Record in Production</title><link>http://www.sqlservercentral.com/Forums/Topic976256-149-1.aspx</link><description>[quote][b]sqlusers (8/27/2010)[/b][hr]Hi,	In our Production database, sometimes back the data getting duplicated because of not deleteing the old records. At now only we have come to know that the data gets duplicated. We want to delete those duplicated datas.                Here what a concern is we have nearly more than 1 crore data in the table. From that we need to delete. Can suggest us how can we do this in Production? [/quote]First you do it in a test database, once validated you go for production.Plenty of scripts on the net.My suggestion is to revise table design, proper architecture would prevent duplicate rows. Most probably the implementation of a single unique index wdould do the trickHope this helps.</description><pubDate>Fri, 27 Aug 2010 11:59:38 GMT</pubDate><dc:creator>PaulB-TheOneAndOnly</dc:creator></item><item><title>Deleting Duplicate Record in Production</title><link>http://www.sqlservercentral.com/Forums/Topic976256-149-1.aspx</link><description>Hi,	In our Production database, sometimes back the data getting duplicated because of not deleteing the old records. At now only we have come to know that the data gets duplicated. We want to delete those duplicated datas.                Here what a concern is we have nearly more than 1 crore data in the table. From that we need to delete. Can suggest us how can we do this in Production? ---</description><pubDate>Fri, 27 Aug 2010 04:00:23 GMT</pubDate><dc:creator>sqlusers</dc:creator></item></channel></rss>