Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Help for Comparing 2 tables

Author  Topic 

a_r_satish
Yak Posting Veteran

84 Posts

Posted - 2006-02-21 : 01:13:50
Hi,
[Purpose is Database Updation]
For my application, i need to compare the table structures in 2 different db(Oracle and SQL)
My db is SQL, so i have moved the Oracle schema structure to my db(SQL).
Now i have to compare the two tables and find out
1.Tables newly added to schema[oracle db] and not in my db[SQL]
2.Tables in my db[SQL] and deleted from the Schema[Oracle]
3.Fields newly added to tables[Oracle] and not in my db[SQL]
4.Fields deleted from tables[Oracle] ad in my DB[SQL]
5.Fields whose datatype and size are mismatched in the two DB.

Hope i am very clear. Oracle refers to the appl db and SQL is my DB.
I have moved the Oracle info required to my DB[SQL].

To Simplify the task, i have decided to break the result into 5 tables,one each for tables added, tables deleted,fields added,fields deleted and fields mismatched.
I need help for creating the Stored procedure for the same.
Can anyone help with the query.

Tables : OtherDB, MyDB
Fields :
OtherDB:TableName, FieldName, DataType, Size, Nullable, Default, constraint, RefTable and RefField.
MyDb: TableName, FieldName, DataType, Size, Nullable, Default, constraint, RefTable and RefField.
I need a stored procedure to find the individual difference.

Thanks in Advance.












Regards,
satish.r

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-02-21 : 01:40:26
Try this
http://weblogs.sqlteam.com/jeffs/archive/2004/11/10/2737.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

a_r_satish
Yak Posting Veteran

84 Posts

Posted - 2006-02-21 : 05:14:37
Thank you sir. That really worked and is an efficient way which i was looking for.

Regards,
satish.r
Go to Top of Page
   

- Advertisement -