<?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: Delete Duplicate Records</title>
	<atom:link href="http://www.sqllion.com/2009/05/delete-duplicate-records/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sqllion.com/2009/05/delete-duplicate-records/</link>
	<description>Welcome to the Database Jungle</description>
	<lastBuildDate>Mon, 06 Sep 2010 03:21:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Babita</title>
		<link>http://www.sqllion.com/2009/05/delete-duplicate-records/comment-page-1/#comment-530</link>
		<dc:creator>Babita</dc:creator>
		<pubDate>Fri, 23 Jul 2010 05:20:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.sqllion.com/?p=358#comment-530</guid>
		<description>Very good post. </description>
		<content:encoded><![CDATA[<p>Very good post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Articles about @@rowcount volume 6 &#171; Article Directory</title>
		<link>http://www.sqllion.com/2009/05/delete-duplicate-records/comment-page-1/#comment-504</link>
		<dc:creator>Articles about @@rowcount volume 6 &#171; Article Directory</dc:creator>
		<pubDate>Sat, 12 Jun 2010 14:59:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.sqllion.com/?p=358#comment-504</guid>
		<description>[...] Delete Duplicate Records &#124; SQL Lion &#8230; from a table without affecting the integrity of the database by using TOP Keyword, SET ROWCOUNT command, IDENTITY column property and by Filtering &#8230; [...]</description>
		<content:encoded><![CDATA[<p>[...] Delete Duplicate Records | SQL Lion &#8230; from a table without affecting the integrity of the database by using TOP Keyword, SET ROWCOUNT command, IDENTITY column property and by Filtering &#8230; [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: FEBRIE DHARMA KUNCORO</title>
		<link>http://www.sqllion.com/2009/05/delete-duplicate-records/comment-page-1/#comment-69</link>
		<dc:creator>FEBRIE DHARMA KUNCORO</dc:creator>
		<pubDate>Tue, 21 Jul 2009 08:41:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.sqllion.com/?p=358#comment-69</guid>
		<description>Hi,usually i use this simple logic to delete duplicate records.

CREATE PROC dbo.DELETE_DUPLICATE_RECORD
AS
BEGIN
 -- Group duplicate table using distinct to temp table
 SELECT DISTINCT * INTO Single_Result FROM Original_table
 -- Clear all data from source table
 TRUNCATE TABLE Original_table
 -- Copy from temp table to source table (original table)
 INSERT INTO Original_table
 SELECT * FROM Single_Result
END
GO

Hope this is more helpful!

Cheers! :)

FEBRIE</description>
		<content:encoded><![CDATA[<p>Hi,usually i use this simple logic to delete duplicate records.</p>
<p>CREATE PROC dbo.DELETE_DUPLICATE_RECORD<br />
AS<br />
BEGIN<br />
 &#8212; Group duplicate table using distinct to temp table<br />
 SELECT DISTINCT * INTO Single_Result FROM Original_table<br />
 &#8212; Clear all data from source table<br />
 TRUNCATE TABLE Original_table<br />
 &#8212; Copy from temp table to source table (original table)<br />
 INSERT INTO Original_table<br />
 SELECT * FROM Single_Result<br />
END<br />
GO</p>
<p>Hope this is more helpful!</p>
<p>Cheers! <img src='http://www.sqllion.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>FEBRIE</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lal</title>
		<link>http://www.sqllion.com/2009/05/delete-duplicate-records/comment-page-1/#comment-48</link>
		<dc:creator>Lal</dc:creator>
		<pubDate>Wed, 10 Jun 2009 21:55:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.sqllion.com/?p=358#comment-48</guid>
		<description>Hi all, another way to find duplicates and remove duplicate.

This query will help you to find the duplicates rows

;WITH CTE(RowNum,CarCompany,CarBodyType,CarName, EngineType) 
AS
(
SELECT ROW_NUMBER() OVER(PARTITION BY CarCompany,CarBodyType,CarName, EngineType 
		ORDER BY CarCompany,CarBodyType,CarName, EngineType) as RowNum,
         CarCompany,CarBodyType,CarName, EngineType
FROM  TEST.[dbo].[CARS] 
)
SELECT * FROM CTE WHERE RowNum &gt;1


To delete/remove the duplicate Please execute the below query.


;WITH CTE(RowNum,CarCompany,CarBodyType,CarName, EngineType) 
AS
(
SELECT ROW_NUMBER() OVER(PARTITION BY CarCompany,CarBodyType,CarName, EngineType 
		ORDER BY CarCompany,CarBodyType,CarName, EngineType) as RowNum,
         CarCompany,CarBodyType,CarName, EngineType
FROM  TEST.[dbo].[CARS] 
)
DELTE FROM CTE WHERE RowNum &gt;1

Hope this is helpful.


Lal</description>
		<content:encoded><![CDATA[<p>Hi all, another way to find duplicates and remove duplicate.</p>
<p>This query will help you to find the duplicates rows</p>
<p>;WITH CTE(RowNum,CarCompany,CarBodyType,CarName, EngineType)<br />
AS<br />
(<br />
SELECT ROW_NUMBER() OVER(PARTITION BY CarCompany,CarBodyType,CarName, EngineType<br />
		ORDER BY CarCompany,CarBodyType,CarName, EngineType) as RowNum,<br />
         CarCompany,CarBodyType,CarName, EngineType<br />
FROM  TEST.[dbo].[CARS]<br />
)<br />
SELECT * FROM CTE WHERE RowNum &gt;1</p>
<p>To delete/remove the duplicate Please execute the below query.</p>
<p>;WITH CTE(RowNum,CarCompany,CarBodyType,CarName, EngineType)<br />
AS<br />
(<br />
SELECT ROW_NUMBER() OVER(PARTITION BY CarCompany,CarBodyType,CarName, EngineType<br />
		ORDER BY CarCompany,CarBodyType,CarName, EngineType) as RowNum,<br />
         CarCompany,CarBodyType,CarName, EngineType<br />
FROM  TEST.[dbo].[CARS]<br />
)<br />
DELTE FROM CTE WHERE RowNum &gt;1</p>
<p>Hope this is helpful.</p>
<p>Lal</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arun Mallick</title>
		<link>http://www.sqllion.com/2009/05/delete-duplicate-records/comment-page-1/#comment-28</link>
		<dc:creator>Arun Mallick</dc:creator>
		<pubDate>Fri, 29 May 2009 16:35:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.sqllion.com/?p=358#comment-28</guid>
		<description>Dear Readers, 
Here is another way of deleting redundant rows by using IDENTITY column.
DELETE FROM  dbo.Cars
	WHERE
EXISTS
(SELECT IdentityColmn FROM dbo.Cars T 
	WHERE T.CarCompany = dbo.Cars.CarCompany and T.CarBodyType= dbo.Cars.CarBodyType and T.CarName= dbo.Cars.CarName and T.EngineType = dbo.Cars.EngineType  AND T.IdentityColmn &lt; dbo.Cars.IdentityColmn) 

Thanks.</description>
		<content:encoded><![CDATA[<p>Dear Readers,<br />
Here is another way of deleting redundant rows by using IDENTITY column.<br />
DELETE FROM  dbo.Cars<br />
	WHERE<br />
EXISTS<br />
(SELECT IdentityColmn FROM dbo.Cars T<br />
	WHERE T.CarCompany = dbo.Cars.CarCompany and T.CarBodyType= dbo.Cars.CarBodyType and T.CarName= dbo.Cars.CarName and T.EngineType = dbo.Cars.EngineType  AND T.IdentityColmn < dbo.Cars.IdentityColmn) </p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
