MSSQL跨服务器查询
Posted 一佳一
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MSSQL跨服务器查询相关的知识,希望对你有一定的参考价值。
1.因为此功能服务器安全配置的一部分而被关闭,所以我们先开启
exec sp_configure ‘show advanced options‘,1 reconfigure exec sp_configure ‘Ad Hoc Distributed Queries‘,1 reconfigure
2.如果需要关闭,执行
exec sp_configure ‘Ad Hoc Distributed Queries‘,0 reconfigure exec sp_configure ‘show advanced options‘,0 reconfigure
3.查询语句
SELECT * FROM OPENDATASOURCE( ‘SQLOLEDB‘, ‘Data Source=远程IP地址;User ID=sa;Password=密码‘ ).数据库.dbo.表名
以上是关于MSSQL跨服务器查询的主要内容,如果未能解决你的问题,请参考以下文章