Tool for Sql Database comparison tool.....

divagara

Disciple
Hi,

Is thr any tool (freeware if possible) to compare the data in two sql databases.....
if not how can i go abt doing it...??/

thank u.......:)
 
^^ I agree. The original question is not very clear. Do you want to compare data in two tables on different schemas? And which SQL database is in question: MS SQL Server or Oracle?
 
sorry for da incomplete question....i want to compare tables in two sql databases with similar schemas..............
thank u....
 
Again, you are missing the DB server info. MS SQL Server or Oracle?

AFAIK, there isn't any tool to do so. But, for simple comparisons, you can try using databse links. Database links really facilitate you to use both the tables from different schemas in a single query.

For example, you can do the following:

1. Create a link between your schemas:

1.a: Use
Code:
Create Database Link <LinkName> connect to <Schema2User> identified by <Schema2Password> using '<SID>'
for Oracle.

1.b: Use
Code:
SP_AddLinkedServer
for MS SQL Server. Not sure of the exact syntax.

2. Knowing what exactly is to be compared, you can then write a simple query (I took an example where you'd like to know the records where Employees' record(s) itself does not exist in the other schema table):

Code:
Select * From Employees E1

Where Not Exists (Select 1 From Employees@<LinkName> E2 Where E1.UserUID = E2.UserUID)

Select * From Employees@<LinkName> E1

Where Not Exists (Select 1 From Employees E2 Where E1.UserUID = E2.UserUID)

The above is Oracle query syntax. But, it won't be much different for MS SQL Server. Just use the 4 part naming for MS SQL Server. And depending upon your comparison need, you can either use Not Exists/ Exists or do a simple join of the tables.
 
Back
Top