/*跨多个服务器访问不同的表的方法一
*先创建链接服务器TESTT,
*在MSSQL2008下不能直接修改链接服务器 'TESTT' 的RPC配置成TURE,可以通过语句修改如下:
*/
USE [master]
GO
EXEC master.dbo.sp_serveroption @server=N'TESTT', @optname=N'rpc', @optvalue=N'true'
GO
EXEC master.dbo.sp_serveroption @server=N'TESTT', @optname=N'rpc out', @optvalue=N'true'
GO
--然后通过sql语句访问
select * from [TESTT].[ONLINE_PAYMENT].[dbo].[TB_USER]

/*跨多个服务器访问不同的表的方法二*/
--启用Ad Hoc Distributed Queries: 
exec sp_configure 'show advanced options',1 
reconfigure 
exec sp_configure 'Ad Hoc Distributed Queries',1 
reconfigure 
--访问语句 这样写
select * from openrowset('sqloledb','10.176.24.111';'sa';'123',ONLINE_PAYMENT.dbo.TB_USER) a
--关闭Ad Hoc Distributed Queries: 
exec sp_configure 'Ad Hoc Distributed Queries',0 
reconfigure 
exec sp_configure 'show advanced options',0 
reconfigure

 

相关文章:

  • 2021-10-16
  • 2022-12-23
  • 2021-12-20
  • 2021-10-25
  • 2021-06-24
  • 2021-11-13
  • 2021-07-09
猜你喜欢
  • 2021-10-01
  • 2021-08-10
  • 2021-10-13
  • 2021-11-10
  • 2022-12-23
  • 2021-09-19
相关资源
相似解决方案