赞
踩
Ad Hoc Distributed Queries 服务 因为这个服务不安全sqlServer默认关闭该服务
我们需要注意的是在开启服务完成查询后,一定要记得关闭这个服务。
开启 Ad Hoc Distributed Queries :
exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure
关闭:
exec sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
exec sp_configure 'show advanced options',0
reconfigure
远程查询:
select top 10 * from
openrowset
( 'SQLOLEDB','10.122.127.20' ; 'sa';'exp123' ,Expense2BizA.dbo.tblsheet)
关键字指定连接方式 服务器 用户 密码 数据库 表名
-- 生成本地表
select * into 表 from openrowset ( ' SQLOLEDB ' , ' sql服务器名 ' ; ' 用户名 ' ; ' 密码 ' ,数据库名.dbo.表名)
-- 把本地表导入远程表
insert openrowset ( ' SQLOLEDB ' , ' sql服务器名 ' ; ' 用户名 ' ; ' 密码 ' ,数据库名.dbo.表名)
select * from 本地表
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。