—-开启服务器
exec sp_configure ‘show advanced options’,1
reconfigure
exec sp_configure ‘ad hoc distributed queries’,1
reconfigure
–访问数据库(可以进行数据操作)
select * from opendatasource(‘sqloledb’,’data source=a;user id=c;password=c’).db.dbo.表名
—-关闭服务器数据库
exec sp_configure ‘ad hoc distributed queries’,0
reconfigure
exec sp_configure ‘show advanced options’,0
reconfigure