尝试在 SSDT 中进行一些简单的数据比较,但事实证明有点困难。
在一个数据库中,我有两个要比较的表。
这些表具有相同的架构,只是表名称不同。我只是想看看这个工具是否能给我一个很好的方法来比较两者的数据。
即
tblOutput
tblOutput_210314
但是选择两个表在单个数据库中相互比较我不知道如何实现。
似乎您只能选择源数据库和目标数据库中都存在的表名称。由于我的源数据库和目标数据库相同,我基本上是将我的表与其本身进行比较?
有人知道如何使用数据比较来实现这一目标吗?
- Visual Studio 2012
- SQL Server 数据工具
- 数据比较
最佳答案
数据比较仅支持比较具有匹配架构的 2 个不同数据库。不幸的是,您无法使用数据比较来完成您想要的事情。来自 help documentation :
Requirements
When you compare data in a table or view, the table or view in the source database must share several attributes with a table or view in the target database. Tables and views that do not meet the following criteria are not compared and do not appear on the second page of the New Data Comparison wizard:
- Tables must have matching column names that have compatible data types.
- Names of tables, views, and owners are case-sensitive.
- Tables must have the same primary key, unique index, or unique constraint.
- Views must have the same unique, clustered index.
- You can compare a table with a view only if they have the same name.
关于sql-server - Visual Studio SSDT Data Compare如何比较单个数据库中的两个表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22220605/