<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: SQL Server code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Tue, 07 Oct 2008 13:50:16 GMT</pubDate>
    <description>DZone Snippets: SQL Server code</description>
    <item>
      <title>SQL SERVER: Delete Duplicate Rows with Primary Id</title>
      <link>http://snippets.dzone.com/posts/show/4482</link>
      <description>Deletes duplicates (leaving one instance) where the table has a primary key. Good for tables with Id, DupColumn, DupColumn...&lt;br /&gt;&lt;br /&gt;(This is MS-SQL specific)&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;DELETE&lt;br /&gt;FROM 	TableName&lt;br /&gt;WHERE 	Id NOT IN&lt;br /&gt;	(SELECT 	MAX(Id)&lt;br /&gt;        FROM   		TableName&lt;br /&gt;        GROUP BY 	DuplicateColumName1, DuplicateColumName2)&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 31 Aug 2007 19:12:09 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4482</guid>
      <author>cornerblue (CornerBLUE, Inc.)</author>
    </item>
  </channel>
</rss>
