Hi all,
I have two databases of same schema. Data in one database is supposed to be
a subset of another database. Is there any way to verify that?
Thanks,
LarryHi,
Did you mean the data in both databases are same or just the subset. If your
objective is to compare the data then you could go
for SQLDataCompare a tool from redgate software.
http://www.red-gate.com/products/SQ...mpare/index.htm
Thanks
Hari
"Larry Lau" <LarryLau@.discussions.microsoft.com> wrote in message
news:226C3EBE-F747-460E-9AB8-71049B973AC3@.microsoft.com...
> Hi all,
> I have two databases of same schema. Data in one database is supposed to
> be
> a subset of another database. Is there any way to verify that?
> Thanks,
> Larry|||Assume that database. [dbB].dbo.MyTable is a subset of [dbA].dbo.MyT
able.
This query should return any rows in [dbB] that do NOT exists in [db
A]. If you want to verify down to the field level, it will take some more wo
rk.
SELECT b.PKField
FROM [dbB].dbo.MyTable b
LEFT JOIN [dbA].dbo.MyTable a
ON b.PKField = a.PKField
WHERE a.PKField IS NULL
--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"Larry Lau" <LarryLau@.discussions.microsoft.com> wrote in message news:226C3EBE-F747-460E-9A
B8-71049B973AC3@.microsoft.com...
> Hi all,
>
> I have two databases of same schema. Data in one database is supposed to
be
> a subset of another database. Is there any way to verify that?
>
> Thanks,
> Larry|||Larry,
there is a utility in SQL Server 2005 for this called TABLEDIFF
(http://www.replicationanswers.com/TableDiff2005.asp). It can be useful for
single tables but if you have a number that need comparing then I'd use
DataCompare as Hari Prasad mentions.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment