﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Article Discussions / Article Discussions by Author / Discuss content posted by George Varkey  / Deleting Duplicate batches of rows / 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 21:31:24 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Deleting Duplicate batches of rows</title><link>http://www.sqlservercentral.com/Forums/Topic538145-1343-1.aspx</link><description>Thank you for sharing this.  It was my introduction to cursors, and I was able to adapt it to keep my input table intact (by adding top(1) to another table, instead of deleting top @cnt).Going forward, it does appear the common table expression approach linked by Nick has more promise.  All I wanted was something like 'Ignore row errors on insert'!</description><pubDate>Fri, 02 Jan 2009 11:31:31 GMT</pubDate><dc:creator>blairxy</dc:creator></item><item><title>RE: Deleting Duplicate batches of rows</title><link>http://www.sqlservercentral.com/Forums/Topic538145-1343-1.aspx</link><description>[quote]SELECT DISTINCT * from tableName[/quote]While this gives you a list of records without the duplicates, it does not help much in deleting the duplicates. Additional code is still need to do something to remove the duplicates from the original table which this article addresses along with the other suggestions.</description><pubDate>Wed, 08 Oct 2008 01:23:35 GMT</pubDate><dc:creator>Nick Hobbs</dc:creator></item><item><title>RE: Deleting Duplicate batches of rows</title><link>http://www.sqlservercentral.com/Forums/Topic538145-1343-1.aspx</link><description>A much simpler way to remove duplicates would be to use SELECT DISTINCT * from tableName</description><pubDate>Tue, 07 Oct 2008 14:23:02 GMT</pubDate><dc:creator>irina-813672</dc:creator></item><item><title>RE: Deleting Duplicate batches of rows</title><link>http://www.sqlservercentral.com/Forums/Topic538145-1343-1.aspx</link><description>I am sure the code works fine, however the article implied that this is one situation where you have to use cursors - which are very inefficient if you can do it alternatively in a single query:[i]&amp;gt;&amp;gt;This code works in SQL Server 2005 and above, because it uses the delete top (N) statement. Although using a cursor is not always a good idea but [b]there are situations where we have to use it[/b].[/i]I am sure the cursor method with copying the data to a temporary table is satisfactory for small sets of data. I was surprised however to see it listed as a featured article in SQL Server Central's daily newsletter. When having to regularly run a query against e.g. 1m+ records that may involve several tables, it helps to know if there are more efficient methods. I thought it was worth pointing to a more efficient method that I came across recently as this is not a situation where we have to use cursors.RegardsNick</description><pubDate>Mon, 06 Oct 2008 01:42:14 GMT</pubDate><dc:creator>Nick Hobbs</dc:creator></item><item><title>RE: Deleting Duplicate batches of rows</title><link>http://www.sqlservercentral.com/Forums/Topic538145-1343-1.aspx</link><description>The code worked fine for me.  There is more than one way to do this.  So if you don't like this way try another but in terms of results this code works.</description><pubDate>Fri, 03 Oct 2008 12:17:52 GMT</pubDate><dc:creator>fhanlon</dc:creator></item><item><title>RE: Deleting Duplicate batches of rows</title><link>http://www.sqlservercentral.com/Forums/Topic538145-1343-1.aspx</link><description>don't need a temp table.  don't need cursors.you can remove dups in one statement.cheers.</description><pubDate>Fri, 03 Oct 2008 11:45:52 GMT</pubDate><dc:creator>tzara</dc:creator></item><item><title>RE: Deleting Duplicate batches of rows</title><link>http://www.sqlservercentral.com/Forums/Topic538145-1343-1.aspx</link><description>I think this is a much more efficient example for deleting duplicate rows using a single query and not having to resort to using Cursors:http://dipakjpatel.blogspot.com/2007/08/delete-duplicate-rows-using-single.htmlRegardsNick</description><pubDate>Fri, 03 Oct 2008 01:19:38 GMT</pubDate><dc:creator>Nick Hobbs</dc:creator></item><item><title>RE: Deleting Duplicate batches of rows</title><link>http://www.sqlservercentral.com/Forums/Topic538145-1343-1.aspx</link><description>Ritesh what is it that is not working, can you let me know.</description><pubDate>Thu, 21 Aug 2008 05:31:28 GMT</pubDate><dc:creator>George Damien Varkey</dc:creator></item><item><title>RE: Deleting Duplicate batches of rows</title><link>http://www.sqlservercentral.com/Forums/Topic538145-1343-1.aspx</link><description>This code does not give proper results. I tried to work on this but its really untested bad work by the developer.</description><pubDate>Mon, 21 Jul 2008 23:23:45 GMT</pubDate><dc:creator>totlani.ritesh</dc:creator></item><item><title>Deleting Duplicate batches of rows</title><link>http://www.sqlservercentral.com/Forums/Topic538145-1343-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/scripts/T-SQL/63766/"&gt;Deleting Duplicate batches of rows&lt;/A&gt;[/B]</description><pubDate>Mon, 21 Jul 2008 22:52:11 GMT</pubDate><dc:creator>George Damien Varkey</dc:creator></item></channel></rss>