Posted by AK on 02/11/06 19:30
Hi
Our product uses MS-SQL Server 2000. One of our customer has 10
installations with each installation stroring data in its own database.
Now the customer wants to consolidate these databases into one and we
already have plan for that by consolidating one DB at a time. But first
they want to find how many unique or duplicate entries they have across
all the 10 databases
Assumptions:
1. All the databases reside on the same server. (This is just an
assumption, not the real environment at customer site)
2. Databases can not be merged before it is found how many unique or
duplicate rows exist.
Table under consideration:
Message
(
HashID PK,
....
)
# of rows in Message table in each of databases: 1 Million
Here is my question: How can I find how many unique or duplicate
entries they have across all the 10 databases. I easily find unique
rows for two databases with a query like this:
SELECT COUNT(A.HasID) FROM db1.dbo.Message A LEFT OUTER JOIN ON
db2.dbo.Message B ON A.HashID = B.HashID WHERE B.HashID IS NULL
How can I do this for 10 databases. This will require factorial of 10
queries to solve this problem.
I will appreciate if someone can provide hint on this.
Regards
AK
Navigation:
[Reply to this message]
|