`
cary
  • 浏览: 84291 次
  • 性别: Icon_minigender_1
  • 来自: 合肥
社区版块
存档分类
最新评论

MS SQL SERVER2005跨服务器查询

    博客分类:
  • DB
阅读更多
1:打开'Ad Hoc Distributed Queries'

exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure

关闭只要将1设置为0

2:建立链路服务器
EXEC   sp_addlinkedserver    
        '120Host',     //昵称
        '',    
        'SQLOLEDB',  
        NULL,  
        NULL,  
        'DRIVER={SQL   Server};SERVER=IP,1433;UID=sa;PWD=;'
go
exec   sp_addlinkedsrvlogin   '120Host','false','sa','sa',''  
GO  

3:既可以建立查询
select *
from openquery([120Host],'select * from 库名.dbo.表名')
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics