Fork me on GitHub

SQL Server 不同数据库导入指定数据解决方案

复制代码
 1 use 待导入DB
2 go
3
4 /*启动Ad Hoc Distributed Queries*/
5 exec sp_configure 'show advanced options',1
6 reconfigure
7 exec sp_configure 'Ad Hoc Distributed Queries',1
8 reconfigure
9
10 insert into 待导入DB.dbo.表名
11 select top 10 sid from opendatasource('SQLOLEDB','data source=ip;USER ID=sa;PASSWORD=sa').数据源DB.dbo.表名
12
13
14 /*关闭Ad Hoc Distributed Queries*/
15 exec sp_configure 'Ad Hoc Distributed Queries',0
16 reconfigure
17 exec sp_configure 'show advanced options',0
18 reconfigure
复制代码
posted @   磊哥|www.javacn.site  阅读(382)  评论(0编辑  收藏  举报
编辑推荐:
· .NET Core 托管堆内存泄露/CPU异常的常见思路
· PostgreSQL 和 SQL Server 在统计信息维护中的关键差异
· C++代码改造为UTF-8编码问题的总结
· DeepSeek 解答了困扰我五年的技术问题
· 为什么说在企业级应用开发中,后端往往是效率杀手?
阅读排行:
· 清华大学推出第四讲使用 DeepSeek + DeepResearch 让科研像聊天一样简单!
· 推荐几款开源且免费的 .NET MAUI 组件库
· 实操Deepseek接入个人知识库
· 易语言 —— 开山篇
· Trae初体验
点击右上角即可分享
微信分享提示