zoukankan      html  css  js  c++  java
  • 跨多个服务器访问不同数据库的表的方法

    /*跨多个服务器访问不同的表的方法一
    *先创建链接服务器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
  • 相关阅读:
    CSS
    js
    js
    js
    JS
    Service Worker 学习笔记
    JS JavaScript模块化(ES Module/CommonJS/AMD/CMD)
    前端开发 JavaScript 规范文档
    HTML HTML5 新特性
    JS 设计模式九 -- 装饰器模式
  • 原文地址:https://www.cnblogs.com/sevene/p/6905040.html
Copyright © 2011-2022 走看看