SQL Server 跨库查询
生活随笔
收集整理的這篇文章主要介紹了
SQL Server 跨库查询
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
1.?開啟Ad Hoc Distributed Queries組件,在sql查詢編輯器中執(zhí)行如下語句:
exec sp_configure 'show advanced options',1 reconfigure exec sp_configure 'Ad Hoc Distributed Queries',1 reconfigure2.?跨庫查詢操作
select * from OPENDATASOURCE('SQLOLEDB',
'Data Source=遠程ip;User ID=sa;Password=密碼'
).庫名.dbo.表名
例如: select * from OPENDATASOURCE( 'SQLOLEDB', 'Data Source=10.2.2.53;User ID=sa;Password=779i$4' ).MDXT_O_S_01.dbo.MDMZGZDRecord
3.?關閉Ad Hoc Distributed Queries組件,在sql查詢編輯器中執(zhí)行如下語句:
exec sp_configure 'Ad Hoc Distributed Queries',0 reconfigure exec sp_configure 'show advanced options',0 reconfigure?
轉(zhuǎn)載于:https://www.cnblogs.com/zhchsh/p/9111536.html
總結
以上是生活随笔為你收集整理的SQL Server 跨库查询的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: OO第三次博客总结作业
- 下一篇: Python是一门什么样的语言