sql - 如何使用本地服务器数据库中的 where 条件从链接服务器表中删除数据
问题描述
我有两个要同步的数据库,我想从托管数据库表而不是本地数据库表中删除数据..我的表名是全局的
我正在使用 sql server 2008R2
预先感谢您的帮助
delete [sql5025.site4now.net].DB_9BDE_alfaSuit.dbo.[global] where no not in (select no from [global])
解决方案
只需添加本地数据库的别名。
delete [sql5025.site4now.net].DB_9BDE_alfaSuit.dbo.[global] where no not in
(select no from DB_9BDE_alfaSuit.dbo.[global])
这将从链接服务器返回数据
select * from [sql5025.site4now.net].DB_9BDE_alfaSuit.dbo.[global]
这将从本地服务器返回数据
select * from DB_9BDE_alfaSuit.dbo.[global]
推荐阅读
- java - JAVA how to simplify iteration
- powershell - 如果从集合中选择选项,如何将参数设置为强制
- json - 使用 Groovy 将 yaml 转换为 json
- python - Pandas 为每列合并具有不同操作的行
- python - 根据几个条件将列表中的项目替换为另一个项目(小列表)
- sql - 如何根据其他值的组合写入值
- javascript - Javascript记录器和blob问题
- azure-cosmosdb - 如何在 Gremlin 中将边从一个顶点复制到新顶点
- cordova - Ionic 4 oauth 重定向连接被拒绝
- node.js - JavaScript AWS 客户端网关 API x-api-key 问题