iSQlServer
1.开通分布式查询权限
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