user1837575 user1837575 - 1 year ago 97
SQL Question

How do I compare two tables in different databases

I have two databases, which are basically identical running on the same machine.

I would like to compare the records in a table on database A vs the same table in database B

I would like to know which records exist in the table on database A that do not exist in the same table on database B.

Database A = "RICSTOREV341"
Database B = "RICHOSTV341"

The table is "Price_Tab"

The columns I would like to pull are F01, F26, F27, F19, F38

Can this be accomplished?

Answer Source

Yes, this can be done.

You could use something like a three part identifier to identify the tables in different database. Kinda like this :


Then you can perform a join on the primary key and fetch the result.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download