1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
-- 跨库查询
select * FROM OPENDATASOURCE(
'SQLOLEDB',
'Data Source=192.168.0.5,1433;User ID=sa;Password=sa'
).dbName.dbo.tableName
-- 打开
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
|