Visual Studio SSDT数据比较如何在一个数据库中比较两个表 [英] Visual Studio SSDT Data Compare how to compare two tables in a single database

查看:169
本文介绍了Visual Studio SSDT数据比较如何在一个数据库中比较两个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试在SSDT中做一些简单的数据比较,但证明有点困难.

Trying to do something simple Data Compare in SSDT but proving a bit hard.

在一个数据库中,我有两个表要比较.

In one database, I have two tables I want to compare.

这些表具有相同的架构,只是表名称不同.我只是想看看这个工具是否可以为我提供一个比较两者中数据的好方法.

These tables have the same schema, just different table names. And I just want to see if this tool will give me a nice way to compare the data in both.

tblOutput
tblOutput_210314

但是,在一个数据库中选择两个表进行相互比较,我看不出如何实现.

But this picking of two tables to compare against each other in a single database I can't see how to achieve.

似乎您只能选择源数据库和目标数据库中都存在的表名.由于我的源数据库和目标数据库相同,因此我基本上是将自己的表与自己进行比较?

Seems like you can only pick a table name which exists in both source and target databases. Since my source and target database is the same, I am basically comparing my table to itself ?

有人知道使用数据比较来实现此目的的方法吗?

Anyone know of a way to achieve this with Data Compare ?

  • Visual Studio 2012
  • SQL Server数据工具
  • 数据比较

推荐答案

数据比较仅支持比较两个具有匹配模式的不同数据库.不幸的是,您无法使用数据比较来完成您想要的工作.从帮助文档:

Data Compare only supports comparing 2 different databases with matching schemas. Unfortunately you can't do what you are looking to with Data Compare. From the help documentation:

要求

当您比较表或视图中的数据时,表或 源数据库中的视图必须与一个表共享多个属性 或在目标数据库中查看.不符合条件的表和视图 以下条件不进行比较,并且不出现在第二个 新数据比较"向导的页面:

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.

这篇关于Visual Studio SSDT数据比较如何在一个数据库中比较两个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆