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