<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How to Identify and Delete Duplicate SQL Server Records</title>
	<atom:link href="http://www.sql-server-performance.com/2003/delete-duplicates/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sql-server-performance.com/2003/delete-duplicates/</link>
	<description>SQL Server Performance Tuning</description>
	<lastBuildDate>Fri, 17 May 2013 13:31:24 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>By: Naga vara prasad</title>
		<link>http://www.sql-server-performance.com/2003/delete-duplicates/#comment-2010</link>
		<dc:creator>Naga vara prasad</dc:creator>
		<pubDate>Wed, 20 Jun 2012 11:55:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.sql-server-performance.com/?=431#comment-2010</guid>
		<description><![CDATA[select distinct * into newtablename from oldtablename
now the newtablename will have no duplicate records
now simply change the table name(newtablename) by pressing F2 in object explore in sql server]]></description>
		<content:encoded><![CDATA[<p>select distinct * into newtablename from oldtablename</p>
<p>now the newtablename will have no duplicate records</p>
<p>now simply change the table name(newtablename) by pressing F2 in object explore in sql server</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Naveeta</title>
		<link>http://www.sql-server-performance.com/2003/delete-duplicates/#comment-674</link>
		<dc:creator>Naveeta</dc:creator>
		<pubDate>Tue, 04 Oct 2011 10:07:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.sql-server-performance.com/?=431#comment-674</guid>
		<description><![CDATA[I suggest the following code instead..please let me know if there are any issuesd with this
/**********************************************
Example of a simple duplicate data delete script.
**********************************************/
/**********************************************
Set up test environment
**********************************************/
SET NOCOUNT ON
--Create test table
IF OBJECT_ID(&#039;tDupData&#039;) IS NOT NULL
DROP TABLE tDupData
GO
CREATE TABLE tDupData
(
lngCompanyID INTEGER
,strCompanyName VARCHAR(20)
,strAddress VARCHAR(10)
,dtmModified DATETIME
)
--Create test data
INSERT INTO tDupData VALUES (1,&#039;CompanyOne&#039;,&#039;Address1&#039;,&#039;01/15/2003&#039;)
INSERT INTO tDupData VALUES (2,&#039;CompanyTwo&#039;,&#039;Address2&#039;,&#039;01/15/2003&#039;)
INSERT INTO tDupData VALUES (3,&#039;CompanyThree&#039;,&#039;Address3&#039;,&#039;01/15/2003&#039;)
INSERT INTO tDupData VALUES (2,&#039;CompanyTwo&#039;,&#039;Address&#039;,&#039;01/16/2003&#039;)
INSERT INTO tDupData VALUES (3,&#039;CompanyThree&#039;,&#039;Address&#039;,&#039;01/16/2003&#039;)
-- Dup Data
INSERT INTO tDupData VALUES (1,&#039;CompanyOne&#039;,&#039;Address1&#039;,&#039;01/15/2003&#039;)
GO
/**********************************************
Finish set up
**********************************************/
/**********************************************
Simple duplicate data
**********************************************/
--Create temp table to hold duplicate data
CREATE TABLE #tempduplicatedata
(
lngCompanyID INTEGER
,strCompanyName VARCHAR(20)
,strAddress VARCHAR(10)
,dtmModified DATETIME
)
--Identify and save distinct records into temp table
INSERT INTO #tempduplicatedata
SELECT distinct * FROM tDupData
--truncate tDupData
Truncate table tDupData
--Insert unique records in table
INSERT INTO tDupData
Select * from #tempduplicatedata
Go]]></description>
		<content:encoded><![CDATA[<p>I suggest the following code instead..please let me know if there are any issuesd with this<br />
/**********************************************<br />
Example of a simple duplicate data delete script.<br />
**********************************************/<br />
/**********************************************<br />
Set up test environment<br />
**********************************************/<br />
SET NOCOUNT ON<br />
&#8211;Create test table<br />
IF OBJECT_ID(&#8216;tDupData&#8217;) IS NOT NULL<br />
DROP TABLE tDupData<br />
GO<br />
CREATE TABLE tDupData<br />
(<br />
lngCompanyID INTEGER<br />
,strCompanyName VARCHAR(20)<br />
,strAddress VARCHAR(10)<br />
,dtmModified DATETIME<br />
)<br />
&#8211;Create test data<br />
INSERT INTO tDupData VALUES (1,&#8217;CompanyOne&#8217;,'Address1&#8242;,&#8217;01/15/2003&#8242;)<br />
INSERT INTO tDupData VALUES (2,&#8217;CompanyTwo&#8217;,'Address2&#8242;,&#8217;01/15/2003&#8242;)<br />
INSERT INTO tDupData VALUES (3,&#8217;CompanyThree&#8217;,'Address3&#8242;,&#8217;01/15/2003&#8242;)<br />
INSERT INTO tDupData VALUES (2,&#8217;CompanyTwo&#8217;,'Address&#8217;,&#8217;01/16/2003&#8242;)<br />
INSERT INTO tDupData VALUES (3,&#8217;CompanyThree&#8217;,'Address&#8217;,&#8217;01/16/2003&#8242;)<br />
&#8211; Dup Data<br />
INSERT INTO tDupData VALUES (1,&#8217;CompanyOne&#8217;,'Address1&#8242;,&#8217;01/15/2003&#8242;)<br />
GO<br />
/**********************************************<br />
Finish set up<br />
**********************************************/<br />
/**********************************************<br />
Simple duplicate data<br />
**********************************************/<br />
&#8211;Create temp table to hold duplicate data<br />
CREATE TABLE #tempduplicatedata<br />
(<br />
lngCompanyID INTEGER<br />
,strCompanyName VARCHAR(20)<br />
,strAddress VARCHAR(10)<br />
,dtmModified DATETIME<br />
)<br />
&#8211;Identify and save distinct records into temp table<br />
INSERT INTO #tempduplicatedata<br />
SELECT distinct * FROM tDupData</p>
<p>&#8211;truncate tDupData<br />
Truncate table tDupData</p>
<p>&#8211;Insert unique records in table<br />
INSERT INTO tDupData<br />
Select * from #tempduplicatedata</p>
<p>Go</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mohamed</title>
		<link>http://www.sql-server-performance.com/2003/delete-duplicates/#comment-653</link>
		<dc:creator>Mohamed</dc:creator>
		<pubDate>Sun, 02 Oct 2011 04:22:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.sql-server-performance.com/?=431#comment-653</guid>
		<description><![CDATA[--Another idea using ROW_NUMBER()
Delete MyTable
Where Id IN
(
	Select T.Id FROM
	(
		SELECT ROW_NUMBER() OVER (PARTITION BY UniqueColumn ORDER BY Id) AS RowNumber FROM MyTable
	)T
	WHERE T.RowNumber &gt; 1
)]]></description>
		<content:encoded><![CDATA[<p>&#8211;Another idea using ROW_NUMBER()<br />
Delete MyTable<br />
Where Id IN<br />
(<br />
	Select T.Id FROM<br />
	(<br />
		SELECT ROW_NUMBER() OVER (PARTITION BY UniqueColumn ORDER BY Id) AS RowNumber FROM MyTable<br />
	)T<br />
	WHERE T.RowNumber &gt; 1<br />
)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
