SQL Server 作业检查 2 个数据库并根据结果采取行动?
我需要检查不同服务器上类似数据库上的两个表,如果它们包含相同的信息(或大小、哈希,以检查它们是否相同的最佳方式为准),那么其中一个应该删除其信息,每天都有预定的工作。
仅使用 SQL Server Management Studio 中的作业界面是否可以实现这一点?
I need to check 2 tables on similar databases on different servers, if they contain the same information (or size, hash, whichever is the best way to check if they're the same) then one of them should have its information deleted, on a scheduled job every day.
Is this possible using only the Jobs interface from within SQL Server Management Studio?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您使用 SQL 2008 时,您可以使用 MERGE 命令进行检查(假设您仍在此处讨论其他问题中的链接服务器表比较)。
您将设置一个在具有正确权限的帐户下运行的作业,以从链接服务器读取数据作为 MERGE 命令的源,然后删除目标表中与其匹配的条目:
As you are on SQL 2008, you could use the MERGE command to do the check (assuming you are still talking about the linked server table comparison from your other question here).
You would setup a job that runs under an account with the correct permissions to read the data from the linked server as the source for your MERGE command and then delete the entries in your target table that match it: