1) You can get tools that do this.
2) You will get a lot of answers on this one, so let's play a bit and
see if we can do it without referring to columns and using JOINs.
CASE WHEN (SELECT COUNT(*) FROM DB1..TB1)
<> (SELECT COUNT(*) FROM DB2..TB2)
THEN 'No Match'
WHEN (SELECT COUNT(*)
FROM (SELECT * FROM DB1..TB1)
UNION
SELECT * FROM DB2..TB2) AS X)
<> (SELECT COUNT(*) FROM DB2..TB2)
THEN 'No Match'
WHEN (SELECT COUNT(*)
FROM (SELECT * FROM DB1..TB1)
UNION
SELECT * FROM DB2..TB2) AS X)
<> (SELECT COUNT(*) FROM DB1..TB1)
THEN 'No Match'
ELSE 'March!' END
The idea is that the first WHEN clause will be very fast and will
produce results that can be used in the next two WHEN clauses.
--CELKO--
===========================
Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, datatypes, etc. in your
schema are.
*** Sent via Developersdex
http://www.developersdex.com ***