水蒸气压力表:SQL Server 跨域查询(权限、语句、过程)

来源:百度文库 编辑:偶看新闻 时间:2024/04/30 03:20:10

SQL Server 跨域查询(权限、语句、过程)http://www.veryhuo.com 2010-05-05 烈火网 投递稿件 我有话说1.开通分布式查询权限
exec sp_configure 'show advanced options',1
reconfigure

exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure

2.查询

select * from
openrowset( 'SQLOLEDB ', 'IP地址(服务器名)'; '用户名'; '密码',[数据库名].[dbo].[表名]) a
, openrowset( 'SQLOLEDB ', 'IP地址(服务器名)'; '用户名'; '密码',[数据库名].[dbo].[表名]) b
where *** GROUP by *** order by count(1) desc

3.然后换查询条件,然后修改IP、 库名和表名。

4.关闭

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

文章源自:烈火网,原文:http://www.veryhuo.com/a/view/16216.html