SQL仅导入不同的记录
很抱歉,如果之前已经回答过这个问题,但我无法在任何地方找到答案。我在服务器“A”上有一个 SQL 数据库,该数据库已进行更新等,同时服务器“B”上也有相同的数据库。
现在的问题是,一些网站比其他网站移动得更快,并且这些网站正在服务器“B”上进行更新等,而其他网站(可能需要 2 或 3 周的注册时间)则在服务器“A”上进行更新。
问题是,我无法从服务器“A”的 .bak 文件导入到服务器“B”,因为我丢失了服务器 B 的所有数据。无论如何,只从“A”导入与服务器“B”不同的数据?有道理吗?
先感谢您...
So sorry if this has been answered before, but I cannot find an answer anywhere. I have a SQL database on server "A" that has had updates etc etc on it at the same time the same database is on server "B".
Now the issues is, some websites moved over sooner than others and those were being updated etc on server "B" while the other websites (maybe 2 or 3 weeks worth of signups) where being updated on server "A."
Question is, I can't do an import from server "A's" .bak file to server "B's" cause I lose all of server B's data. Anyway to only import data that is different to server "B" from "A?" Make sense?
Thank you in advance...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我建议查看 RedGate 的
SQL Data Compare
和SQL Compare
。您可以创建一次性脚本,但这些工具在这种情况下确实会派上用场。听起来
SQL Data Compare
就是您现在需要的工具。它允许您比较两个数据库之间的数据(您可以选择单个表)并同步它们。在处理标识列和约束时它非常有用。SQL数据比较:
http://www.red-gate.com/products /sql-development/sql-data-compare/
SQL 比较:
http://www.red-gate.com/products/sql -开发/sql-比较/
I would suggest taking a look at
SQL Data Compare
andSQL Compare
from RedGate. You could create a one-time script, but these tools really come in handy for situations like this.It sounds like
SQL Data Compare
is the tool you need right now. It allows you to compare data between two databases (you can select individual tables) and synchronize them. It's extremely useful when dealing with identity columns and constraints.SQL Data Compare:
http://www.red-gate.com/products/sql-development/sql-data-compare/
SQL Compare:
http://www.red-gate.com/products/sql-development/sql-compare/
另请参阅 TSQL 的
MERGE
命令。See also the
MERGE
command for TSQL.我过去曾使用 TableDiff.exe 来执行此操作。这里有一些关于使用它的好文章:
I have used TableDiff.exe in the past to do this. There is are some good articles on using it here: