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)
 Compare the two database tables for field differen

Author  Topic 

thiyait
Yak Posting Veteran

70 Posts

Posted - 2006-11-06 : 09:17:10
Hi all,

i have a two database and n number similar tables with some field difference

i would have list of all tables which contain matched and non matched fields like as

Tablename Database_1 field Database_2 field


Any one help me to solve the problem

Thanks in advance

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-11-06 : 09:18:10
Do you care of the length of varchar columns has been changed?


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

thiyait
Yak Posting Veteran

70 Posts

Posted - 2006-11-06 : 09:36:33
i want to compare both of database table fields throught name not the datatype
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-11-06 : 09:37:50
See this topic!
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=73134


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

thiyait
Yak Posting Veteran

70 Posts

Posted - 2006-11-06 : 09:47:06
Hi Peso,

Thanks for the replay
i m in the need of single query for compare all tables in two databases for similar table name in both side
i want the list like follows

Table name Database_1 fields Database_2 fields
--------------------------------------------------------
Table1 name name
Table1 null Address
Table1 city null
Table1 state state
Table2
.
.
.
.
Above field comparision only through fieldname not through datatypes

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-11-06 : 09:53:31
Why is it important with "a single query"?


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

thiyait
Yak Posting Veteran

70 Posts

Posted - 2006-11-06 : 10:03:01
Hi Peso,
For my scenario i need the single query for result

Thanks in advance

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-11-06 : 10:09:32
You have to use the query in the function above and use a FULL JOIN between the two databases.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-11-06 : 10:20:23
will this help?


Select a.Table_Name,A.Column_Name,B.Table_Name,b.Column_Name
From at_06112006.information_schema.columns a full outer join information_schema.columns b
on a.Table_Name = b.Table_Name and A.Column_Name = B.Column_Name


Chirag

http://chirikworld.blogspot.com/
Go to Top of Page
   

- Advertisement -