<?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>Sun, 18 May 2008 00:20:48 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>
    <item>
      <title>Search for specific text in all stored procedures</title>
      <link>http://snippets.dzone.com/posts/show/3905</link>
      <description>&lt;code&gt;&lt;br /&gt;declare @search varchar(50)&lt;br /&gt;SET @search = 'searchterm'&lt;br /&gt;&lt;br /&gt;SELECT    &lt;br /&gt;     ROUTINE_NAME,&lt;br /&gt;     ROUTINE_DEFINITION&lt;br /&gt;FROM    &lt;br /&gt;    INFORMATION_SCHEMA.ROUTINES&lt;br /&gt;WHERE    &lt;br /&gt;    ROUTINE_DEFINITION LIKE @search&lt;br /&gt;ORDER BY&lt;br /&gt;    ROUTINE_NAME&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 26 Apr 2007 03:08:05 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3905</guid>
      <author>mrtrombone (Mark Easton)</author>
    </item>
    <item>
      <title>Query and join tables across server instances.</title>
      <link>http://snippets.dzone.com/posts/show/3218</link>
      <description>Use the following to query or join tables on remote servers.  The query must be executed on a system running SQL Server, but the remote system can be pretty much anything an ODBC driver exists for:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;select * from OpenDataSource(&#8217;SQLOLEDB&#8216;,&#8217;Data Source=server.asdf.com;User ID=yourusername;Password=yourpassword&#8216;).somedatabase.dbo.sometable;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sun, 31 Dec 2006 09:53:17 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3218</guid>
      <author>gmiller (Greg Miller)</author>
    </item>
  </channel>
</rss>
