I have two databases, which are basically identical running on the same machine.
我有两个数据库,它们在同一台机器上运行是完全相同的。
I would like to compare the records in a table on database A vs the same table in database B
我想比较数据库a上的表和数据库B中相同表中的记录
I would like to know which records exist in the table on database A that do not exist in the same table on database B.
我想知道数据库A的表中有哪些记录不存在于数据库B的同一表中。
Database A = "RICSTOREV341" Database B = "RICHOSTV341"
数据库A = "RICSTOREV341"数据库B = "RICHOSTV341"
The table is "Price_Tab"
表“Price_Tab”
The columns I would like to pull are F01, F26, F27, F19, F38
我想要拉的列是F01 F26 F27 F19 F38
Can this be accomplished?
这是完成了吗?
2 个解决方案
#1
2
Yes, this can be done.
是的,这是可以做到的。
You could use something like a three part identifier to identify the tables in different database. Kinda like this :
您可以使用类似于三部分的标识符来标识不同数据库中的表。有点像这个:
RICSTOREV341.dbo.Price_Tab
Then you can perform a join on the primary key and fetch the result.
然后可以对主键执行连接并获取结果。
#2
0
Besides the solutions above - I can also suggest using some 3rd party tools for performing data comparison, and most of them have a fully functional free trial (like SQL data comparison tools from ApexSQL or Redgate).
除了上面的解决方案之外,我还可以建议使用第三方工具来进行数据比较,而且大多数工具都有一个完全功能的免费试用(比如来自ApexSQL或Redgate的SQL数据比较工具)。
These tools can help you save lots of time, as they can do data comparison and synchronization in just a couple of clicks.
这些工具可以帮助您节省大量时间,因为它们只需几次单击就可以进行数据比较和同步。
Hope I helped.
希望我帮助。
#1
2
Yes, this can be done.
是的,这是可以做到的。
You could use something like a three part identifier to identify the tables in different database. Kinda like this :
您可以使用类似于三部分的标识符来标识不同数据库中的表。有点像这个:
RICSTOREV341.dbo.Price_Tab
Then you can perform a join on the primary key and fetch the result.
然后可以对主键执行连接并获取结果。
#2
0
Besides the solutions above - I can also suggest using some 3rd party tools for performing data comparison, and most of them have a fully functional free trial (like SQL data comparison tools from ApexSQL or Redgate).
除了上面的解决方案之外,我还可以建议使用第三方工具来进行数据比较,而且大多数工具都有一个完全功能的免费试用(比如来自ApexSQL或Redgate的SQL数据比较工具)。
These tools can help you save lots of time, as they can do data comparison and synchronization in just a couple of clicks.
这些工具可以帮助您节省大量时间,因为它们只需几次单击就可以进行数据比较和同步。
Hope I helped.
希望我帮助。