<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Rujith Anand's space - Database</title>
    <link>http://www.rujith.net/RujithBlogTech/</link>
    <description>The techie in me</description>
    <language>en-us</language>
    <copyright>Rujith Anand</copyright>
    <lastBuildDate>Mon, 30 Aug 2010 22:13:00 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.0.7226.0</generator>
    <managingEditor>rujith@rujith.net</managingEditor>
    <webMaster>rujith@rujith.net</webMaster>
    <item>
      <trackback:ping>http://www.rujith.net/RujithBlogTech/Trackback.aspx?guid=21d449c2-00fb-48b6-8ece-714c69180708</trackback:ping>
      <pingback:server>http://www.rujith.net/RujithBlogTech/pingback.aspx</pingback:server>
      <pingback:target>http://www.rujith.net/RujithBlogTech/PermaLink,guid,21d449c2-00fb-48b6-8ece-714c69180708.aspx</pingback:target>
      <dc:creator>Rujith Anand</dc:creator>
      <wfw:comment>http://www.rujith.net/RujithBlogTech/CommentView,guid,21d449c2-00fb-48b6-8ece-714c69180708.aspx</wfw:comment>
      <wfw:commentRss>http://www.rujith.net/RujithBlogTech/SyndicationService.asmx/GetEntryCommentsRss?guid=21d449c2-00fb-48b6-8ece-714c69180708</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Recently I was trying to find duplicate records in a table. The records are considered
duplicate if two columns in different records has the same value. For example if first
name and last name is same in record1 and record2, they considered as duplicate. 
</p>
        <p>
The below query will help to find the duplicate records. 
</p>
        <p>
SELECT fname, lname, COUNT(*) AS DuplicateCount FROM [Users]<br />
GROUP BY fname, lname HAVING COUNT(*) &gt; 1<br />
ORDER BY COUNT(*), fname. 
</p>
        <p>
  
</p>
        <p>
(I know this is pretty simple one, but most of the time you struggle for the simplest
query :) so thought of sharing it)
</p>
      </body>
      <title>Finding duplicate records based on multiple columns in SQL</title>
      <guid isPermaLink="false">http://www.rujith.net/RujithBlogTech/PermaLink,guid,21d449c2-00fb-48b6-8ece-714c69180708.aspx</guid>
      <link>http://www.rujith.net/RujithBlogTech/2010/08/30/FindingDuplicateRecordsBasedOnMultipleColumnsInSQL.aspx</link>
      <pubDate>Mon, 30 Aug 2010 22:13:00 GMT</pubDate>
      <description>&lt;p&gt;
Recently I was trying to find duplicate records in a table. The records are considered
duplicate if two columns in different records has the same value. For example if first
name and last name is same in record1 and record2, they considered as duplicate. 
&lt;/p&gt;
&lt;p&gt;
The below query will help to find the duplicate records. 
&lt;/p&gt;
&lt;p&gt;
SELECT fname, lname, COUNT(*) AS DuplicateCount FROM [Users]&lt;br&gt;
GROUP BY fname, lname HAVING COUNT(*) &amp;gt; 1&lt;br&gt;
ORDER BY COUNT(*), fname. 
&lt;p&gt;
&amp;nbsp; 
&lt;p&gt;
(I know this is pretty simple one, but most of the time you struggle for the simplest
query :) so thought of sharing it)
&lt;/p&gt;</description>
      <comments>http://www.rujith.net/RujithBlogTech/CommentView,guid,21d449c2-00fb-48b6-8ece-714c69180708.aspx</comments>
      <category>Database</category>
    </item>
    <item>
      <trackback:ping>http://www.rujith.net/RujithBlogTech/Trackback.aspx?guid=a1b30200-8959-4137-9419-caf961428798</trackback:ping>
      <pingback:server>http://www.rujith.net/RujithBlogTech/pingback.aspx</pingback:server>
      <pingback:target>http://www.rujith.net/RujithBlogTech/PermaLink,guid,a1b30200-8959-4137-9419-caf961428798.aspx</pingback:target>
      <dc:creator>Rujith Anand</dc:creator>
      <wfw:comment>http://www.rujith.net/RujithBlogTech/CommentView,guid,a1b30200-8959-4137-9419-caf961428798.aspx</wfw:comment>
      <wfw:commentRss>http://www.rujith.net/RujithBlogTech/SyndicationService.asmx/GetEntryCommentsRss?guid=a1b30200-8959-4137-9419-caf961428798</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
ADO.NET data provider for Oracle is dying. ADO.NET team has decided to kill(deprecate)
it in .NET 4.0. How sad isn’t it? Read more about the story on <a href="http://blogs.msdn.com/adonet/archive/2009/06/15/system-data-oracleclient-update.aspx" target="_blank">ADO.NET
team blog</a></p>
        <p>
Though sometimes I feel its unnecessary to have a duplicate copy of Oracle data provider.
Most of the people use ODP.NET or some other third party client. Nice comparison <a href="http://msdn.microsoft.com/en-us/library/ms971518.aspx" target="_blank">here</a> (and
that is why people don’t use .NET Oracle client :))
</p>
        <p>
One very bad thing I noticed about these providers is both of them need Oracle client
installed. For the MS provider(System.Data.OracleClient) the minimum requirement is
Oracle 8i Release 3 (8.1.7) Client or later. Check the requirement in detail here <a href="http://msdn.microsoft.com/en-us/library/2d7h4ycx.aspx" target="_blank">System
Requirements (Oracle).</a><br />
For the ODP.NET Oracle client version 9.2 or later.
</p>
        <p>
Its not always possible to install a large application like Oracle client in some
scenario, so there is an alternative without installing the Oracle client, use <a href="http://www.oracle.com/technology/tech/oci/instantclient/index.html" target="_blank">Oracle
Database Instant Client</a>. Just put Oracle Instant Client in the same folder as
your executable file.
</p>
        <p>
-Rujith
</p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:214bbe38-79b4-4114-940b-6a47b3b45a2d" class="wlWriterEditableSmartContent">Technorati
Tags: <a href="http://technorati.com/tags/Oracle" rel="tag">Oracle</a>,<a href="http://technorati.com/tags/ADO.NET" rel="tag">ADO.NET</a>,<a href="http://technorati.com/tags/Oracle+Data+Client" rel="tag">Oracle
Data Client</a>,<a href="http://technorati.com/tags/Oracle+Instant+client" rel="tag">Oracle
Instant client</a></div>
      </body>
      <title>System.Data.OracleClient is dying</title>
      <guid isPermaLink="false">http://www.rujith.net/RujithBlogTech/PermaLink,guid,a1b30200-8959-4137-9419-caf961428798.aspx</guid>
      <link>http://www.rujith.net/RujithBlogTech/2009/12/04/SystemDataOracleClientIsDying.aspx</link>
      <pubDate>Fri, 04 Dec 2009 15:58:00 GMT</pubDate>
      <description>&lt;p&gt;
ADO.NET data provider for Oracle is dying. ADO.NET team has decided to kill(deprecate)
it in .NET 4.0. How sad isn’t it? Read more about the story on &lt;a href="http://blogs.msdn.com/adonet/archive/2009/06/15/system-data-oracleclient-update.aspx" target="_blank"&gt;ADO.NET
team blog&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Though sometimes I feel its unnecessary to have a duplicate copy of Oracle data provider.
Most of the people use ODP.NET or some other third party client. Nice comparison &lt;a href="http://msdn.microsoft.com/en-us/library/ms971518.aspx" target="_blank"&gt;here&lt;/a&gt; (and
that is why people don’t use .NET Oracle client :))
&lt;/p&gt;
&lt;p&gt;
One very bad thing I noticed about these providers is both of them need Oracle client
installed. For the MS provider(System.Data.OracleClient) the minimum requirement is
Oracle 8i Release 3 (8.1.7) Client or later. Check the requirement in detail here &lt;a href="http://msdn.microsoft.com/en-us/library/2d7h4ycx.aspx" target="_blank"&gt;System
Requirements (Oracle).&lt;/a&gt;
&lt;br&gt;
For the ODP.NET Oracle client version 9.2 or later.
&lt;/p&gt;
&lt;p&gt;
Its not always possible to install a large application like Oracle client in some
scenario, so there is an alternative without installing the Oracle client, use &lt;a href="http://www.oracle.com/technology/tech/oci/instantclient/index.html" target="_blank"&gt;Oracle
Database Instant Client&lt;/a&gt;. Just put Oracle Instant Client in the same folder as
your executable file.
&lt;/p&gt;
&lt;p&gt;
-Rujith
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:214bbe38-79b4-4114-940b-6a47b3b45a2d" class="wlWriterEditableSmartContent"&gt;Technorati
Tags: &lt;a href="http://technorati.com/tags/Oracle" rel="tag"&gt;Oracle&lt;/a&gt;,&lt;a href="http://technorati.com/tags/ADO.NET" rel="tag"&gt;ADO.NET&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Oracle+Data+Client" rel="tag"&gt;Oracle
Data Client&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Oracle+Instant+client" rel="tag"&gt;Oracle
Instant client&lt;/a&gt;
&lt;/div&gt;</description>
      <comments>http://www.rujith.net/RujithBlogTech/CommentView,guid,a1b30200-8959-4137-9419-caf961428798.aspx</comments>
      <category>Coding</category>
      <category>Database</category>
    </item>
    <item>
      <trackback:ping>http://www.rujith.net/RujithBlogTech/Trackback.aspx?guid=9422f4cf-b6d7-47e0-b826-8bdffa426c63</trackback:ping>
      <pingback:server>http://www.rujith.net/RujithBlogTech/pingback.aspx</pingback:server>
      <pingback:target>http://www.rujith.net/RujithBlogTech/PermaLink,guid,9422f4cf-b6d7-47e0-b826-8bdffa426c63.aspx</pingback:target>
      <dc:creator>Rujith Anand</dc:creator>
      <wfw:comment>http://www.rujith.net/RujithBlogTech/CommentView,guid,9422f4cf-b6d7-47e0-b826-8bdffa426c63.aspx</wfw:comment>
      <wfw:commentRss>http://www.rujith.net/RujithBlogTech/SyndicationService.asmx/GetEntryCommentsRss?guid=9422f4cf-b6d7-47e0-b826-8bdffa426c63</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I recently migrated an Oracle database to SQL Server 2005 database. It was an good
experience thought I should share it.
</p>
        <p>
This is not comprehensive guide on migrating data from Oracle to SQL Server 2005,
but describing my experience in doing it.
</p>
        <p>
          <u>Source<br /></u>Oracle 9i<br />
No of databases/schema(Oracle name I guess) = 1<br />
No of tables in the database = 35
</p>
        <p>
          <u>Destination</u>
          <br />
SQL Server 2005<br />
No of database = 1<br />
No of tables in database = 0
</p>
        <p>
In Part 1, I’ll start with establishing connection between these two database server
</p>
        <p>
          <strong>
            <u>Adding Linked Server</u>
          </strong>
        </p>
        <p>
In order to connect the Oracle server from SQL Server 2005 you need to create a <a href="http://msdn.microsoft.com/en-us/library/ms188279.aspx" target="_blank">linked
server</a>. If you are wondering what’s a linked server is, that link has a good picture,
and a picture is worth a thousand words.
</p>
        <p>
You can add a linked server  from the Management Studio as below<br />
Step 1. Go to Server Objects in Objects explorer, expand the tree, on Linked Server
right to add new.<br />
Step 2. Select other datasource and choose Oracle Provider for OLE DB as the provider.<br />
The details on data source, provider string etc are available <a title="Adding linked server" href="http://msdn.microsoft.com/en-us/library/ms190618.aspx" target="_blank">here</a> (on
MSDN, and I am not repeating here to avoid data redundancy :) )
</p>
        <p>
If you don't like the GUI way you can use the script way as described on the MSDN
article <a title="Adding linked server" href="http://msdn.microsoft.com/en-us/library/ms190618.aspx" target="_blank">above</a> (I
used the script method)<br />
Remember you need to install Oracle Client software on the SQL Server machine to do
the above mentioned steps.
</p>
        <p>
To check if the linked server a added correctly, you can use the management studio
or run a sample query<br />
Something similar to 
<br />
SELECT * FROM OPEQUERY(OracleLinkServer, ‘Select * From &lt;any table in Oracle&gt;
‘)
</p>
        <p>
I found the following links helpful while creating linked server. 
<br />
1. How to set up and troubleshoot a linked server to an Oracle database in SQL Server 
<br /><a href="http://support.microsoft.com/kb/280106">http://support.microsoft.com/kb/280106</a><br />
2. Allow inprocess tick box<br /><a title="http://social.msdn.microsoft.com/Forums/en-US/sqldataaccess/thread/b9caa913-3935-4ddb-8c56-33c26b4edd32" href="http://social.msdn.microsoft.com/Forums/en-US/sqldataaccess/thread/b9caa913-3935-4ddb-8c56-33c26b4edd32">http://social.msdn.microsoft.com/Forums/en-US/sqldataaccess/thread/b9caa913-3935-4ddb-8c56-33c26b4edd32</a><br />
3. Limitations of Microsoft Oracle ODBC Driver and OLEDB Provider<br /><a title="http://support.microsoft.com/kb/244661" href="http://support.microsoft.com/kb/244661">http://support.microsoft.com/kb/244661</a><br />
4. <a title="http://social.msdn.microsoft.com/Forums/en-US/sqlexpress/thread/e64476a9-4182-4f89-98ca-f2e489d815b2" href="http://social.msdn.microsoft.com/Forums/en-US/sqlexpress/thread/e64476a9-4182-4f89-98ca-f2e489d815b2">http://social.msdn.microsoft.com/Forums/en-US/sqlexpress/thread/e64476a9-4182-4f89-98ca-f2e489d815b2</a></p>
        <p>
Part 2 will contain preparing migration of tables from Oracle to SQL Server 2005.
</p>
      </body>
      <title>Migrating data from Oracle to SQL Server 2005</title>
      <guid isPermaLink="false">http://www.rujith.net/RujithBlogTech/PermaLink,guid,9422f4cf-b6d7-47e0-b826-8bdffa426c63.aspx</guid>
      <link>http://www.rujith.net/RujithBlogTech/2009/09/20/MigratingDataFromOracleToSQLServer2005.aspx</link>
      <pubDate>Sun, 20 Sep 2009 22:01:00 GMT</pubDate>
      <description>&lt;p&gt;
I recently migrated an Oracle database to SQL Server 2005 database. It was an good
experience thought I should share it.
&lt;/p&gt;
&lt;p&gt;
This is not comprehensive guide on migrating data from Oracle to SQL Server 2005,
but describing my experience in doing it.
&lt;/p&gt;
&lt;p&gt;
&lt;u&gt;Source&lt;br&gt;
&lt;/u&gt;Oracle 9i&lt;br&gt;
No of databases/schema(Oracle name I guess) = 1&lt;br&gt;
No of tables in the database = 35
&lt;/p&gt;
&lt;p&gt;
&lt;u&gt;Destination&lt;/u&gt;
&lt;br&gt;
SQL Server 2005&lt;br&gt;
No of database = 1&lt;br&gt;
No of tables in database = 0
&lt;/p&gt;
&lt;p&gt;
In Part 1, I’ll start with establishing connection between these two database server
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;&lt;u&gt;Adding Linked Server&lt;/u&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
In order to connect the Oracle server from SQL Server 2005 you need to create a &lt;a href="http://msdn.microsoft.com/en-us/library/ms188279.aspx" target="_blank"&gt;linked
server&lt;/a&gt;. If you are wondering what’s a linked server is, that link has a good picture,
and a picture is worth a thousand words.
&lt;/p&gt;
&lt;p&gt;
You can add a linked server&amp;nbsp; from the Management Studio as below&lt;br&gt;
Step 1. Go to Server Objects in Objects explorer, expand the tree, on Linked Server
right to add new.&lt;br&gt;
Step 2. Select other datasource and choose Oracle Provider for OLE DB as the provider.&lt;br&gt;
The details on data source, provider string etc are available &lt;a title="Adding linked server" href="http://msdn.microsoft.com/en-us/library/ms190618.aspx" target="_blank"&gt;here&lt;/a&gt; (on
MSDN, and I am not repeating here to avoid data redundancy :) )
&lt;/p&gt;
&lt;p&gt;
If you don't like the GUI way you can use the script way as described on the MSDN
article &lt;a title="Adding linked server" href="http://msdn.microsoft.com/en-us/library/ms190618.aspx" target="_blank"&gt;above&lt;/a&gt; (I
used the script method)&lt;br&gt;
Remember you need to install Oracle Client software on the SQL Server machine to do
the above mentioned steps.
&lt;/p&gt;
&lt;p&gt;
To check if the linked server a added correctly, you can use the management studio
or run a sample query&lt;br&gt;
Something similar to 
&lt;br&gt;
SELECT * FROM OPEQUERY(OracleLinkServer, ‘Select * From &amp;lt;any table in Oracle&amp;gt;
‘)
&lt;/p&gt;
&lt;p&gt;
I found the following links helpful while creating linked server. 
&lt;br&gt;
1. How to set up and troubleshoot a linked server to an Oracle database in SQL Server 
&lt;br&gt;
&lt;a href="http://support.microsoft.com/kb/280106"&gt;http://support.microsoft.com/kb/280106&lt;/a&gt;
&lt;br&gt;
2. Allow inprocess tick box&lt;br&gt;
&lt;a title="http://social.msdn.microsoft.com/Forums/en-US/sqldataaccess/thread/b9caa913-3935-4ddb-8c56-33c26b4edd32" href="http://social.msdn.microsoft.com/Forums/en-US/sqldataaccess/thread/b9caa913-3935-4ddb-8c56-33c26b4edd32"&gt;http://social.msdn.microsoft.com/Forums/en-US/sqldataaccess/thread/b9caa913-3935-4ddb-8c56-33c26b4edd32&lt;/a&gt;
&lt;br&gt;
3. Limitations of Microsoft Oracle ODBC Driver and OLEDB Provider&lt;br&gt;
&lt;a title="http://support.microsoft.com/kb/244661" href="http://support.microsoft.com/kb/244661"&gt;http://support.microsoft.com/kb/244661&lt;/a&gt;
&lt;br&gt;
4. &lt;a title="http://social.msdn.microsoft.com/Forums/en-US/sqlexpress/thread/e64476a9-4182-4f89-98ca-f2e489d815b2" href="http://social.msdn.microsoft.com/Forums/en-US/sqlexpress/thread/e64476a9-4182-4f89-98ca-f2e489d815b2"&gt;http://social.msdn.microsoft.com/Forums/en-US/sqlexpress/thread/e64476a9-4182-4f89-98ca-f2e489d815b2&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Part 2 will contain preparing migration of tables from Oracle to SQL Server 2005.
&lt;/p&gt;</description>
      <comments>http://www.rujith.net/RujithBlogTech/CommentView,guid,9422f4cf-b6d7-47e0-b826-8bdffa426c63.aspx</comments>
      <category>Database</category>
    </item>
  </channel>
</rss>