如何比较不同机器DB中的两个表数据。 [英] how to compare two tables data in different machines DB.

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

问题描述

我试图通过谷歌找出并找到以下查询,但它对我来说不值得。



I have tried to figure out through google and found the following query but its not worth for me.

SELECT * FROM db.sys.columns WHERE object_id = OBJECT_ID('db.SchemaName.table1')





我正在使用sql server 2005而我没有使用任何链接数据库概念,我可以说一个是服务器数据库而另一个是客户端数据库。两个数据库具有相同的名称和相同的结构,但在不同的机器中。我只需要将一个数据库镜像到另一个数据库。出于这个原因,首先我需要检查一个数据库中是否有任何新记录。



I am using sql server 2005 and i am not using any linked database concept ,i can say one is server db and another is client DB . Both database are with same name and same structure but in different machine . i just need to mirror one database into another . For that reason first i need to check whether there is any new record in one DB.

推荐答案

要跨数据库服务器进行查询,您需要链接服务器设置,如果你不能设置链接服务器。



你可以将数据从两个服务器加载到一个普通服务器,然后使用SET运算符比如UNION,NOT EXISTS,或者你可以使用PowerPivot做同样的事情。
To query across the Database servers you need to have linked server setup, if you cannot set the linked server.

You can load data from both server into once common server, then compare using SET operators like UNION, NOT EXISTS, alternatively you can use PowerPivot do to the same.


这篇关于如何比较不同机器DB中的两个表数据。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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