exec sp_configure 'show advanced options',1
go
reconfigure
go
exec sp_configure 'Ad Hoc Distributed Queries',1
go
reconfigure
go
select * from OPENROWSET
(
'SQLOLEDB',
'SERVER=host;uid=user;pwd=pwd',
'select * from dbname..tbname'
)
exec sp_configure 'Ad Hoc Distributed Queries',0
go
reconfigure
go
exec sp_configure 'show advanced options',0
go
reconfigure