SQL Server 不同数据库导入指定数据解决方案
生活随笔
收集整理的這篇文章主要介紹了
SQL Server 不同数据库导入指定数据解决方案
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
1 use 待導(dǎo)入DB
2 go
3
4 /*啟動(dòng)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 待導(dǎo)入DB.dbo.表名
11 select top 10 sid from opendatasource('SQLOLEDB','data source=ip;USER ID=sa;PASSWORD=sa').數(shù)據(jù)源DB.dbo.表名
12
13
14 /*關(guān)閉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
2 go
3
4 /*啟動(dòng)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 待導(dǎo)入DB.dbo.表名
11 select top 10 sid from opendatasource('SQLOLEDB','data source=ip;USER ID=sa;PASSWORD=sa').數(shù)據(jù)源DB.dbo.表名
12
13
14 /*關(guān)閉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
總結(jié)
以上是生活随笔為你收集整理的SQL Server 不同数据库导入指定数据解决方案的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: js对浏览器内部及外部窗口宽度及高度使用
- 下一篇: js visibility和displa