zoukankan      html  css  js  c++  java
  • sql2008R2新建链接服务器。

    1:用sql新建链接服务器对象:

    /****** Object:  LinkedServer [pad]    Script Date: 10/23/2018 15:47:45 ******/
    EXEC master.dbo.sp_addlinkedserver @server = N'AXMesDB', @srvproduct=N' ', @provider=N'SQLNCLI', @datasrc=N'172.22.160.39'
     /* For security reasons the linked server remote logins password is changed with ######## */
    EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'AXMesDB',@useself=N'False',@locallogin=NULL,@rmtuser=N'数据库登录账号',@rmtpassword='密码'
    
    GO
    
    EXEC master.dbo.sp_serveroption @server=N'AXMesDB', @optname=N'collation compatible', @optvalue=N'false'
    GO
    
    EXEC master.dbo.sp_serveroption @server=N'AXMesDB', @optname=N'data access', @optvalue=N'true'
    GO
    
    EXEC master.dbo.sp_serveroption @server=N'AXMesDB', @optname=N'dist', @optvalue=N'false'
    GO
    
    EXEC master.dbo.sp_serveroption @server=N'AXMesDB', @optname=N'pub', @optvalue=N'false'
    GO
    
    EXEC master.dbo.sp_serveroption @server=N'AXMesDB', @optname=N'rpc', @optvalue=N'false'
    GO
    
    EXEC master.dbo.sp_serveroption @server=N'AXMesDB', @optname=N'rpc out', @optvalue=N'false'
    GO
    
    EXEC master.dbo.sp_serveroption @server=N'AXMesDB', @optname=N'sub', @optvalue=N'false'
    GO
    
    EXEC master.dbo.sp_serveroption @server=N'AXMesDB', @optname=N'connect timeout', @optvalue=N'0'
    GO
    
    EXEC master.dbo.sp_serveroption @server=N'AXMesDB', @optname=N'collation name', @optvalue=null
    GO
    
    EXEC master.dbo.sp_serveroption @server=N'AXMesDB', @optname=N'lazy schema validation', @optvalue=N'false'
    GO
    
    EXEC master.dbo.sp_serveroption @server=N'AXMesDB', @optname=N'query timeout', @optvalue=N'0'
    GO
    
    EXEC master.dbo.sp_serveroption @server=N'AXMesDB', @optname=N'use remote collation', @optvalue=N'true'
    GO
    
    EXEC master.dbo.sp_serveroption @server=N'AXMesDB', @optname=N'remote proc transaction promotion', @optvalue=N'true'
    GO

    2:执行完成后刷新sql后会出现如下图的红框链接对象:

    3:对远程服务器sql查询就可以如下:

  • 相关阅读:
    51Nod 1119 机器人走方格 V2 组合数学 费马小定理
    Codeforces Round #439 div2 869A The Artful Expedient +869B The Eternal Immortality
    51Nod 1050 循环数组最大子段和 dp
    51Nod 1009 数字1的数量 数位dp
    51Nod 1082 与7无关的数 暴力打表(埃氏筛的感觉)
    POJ 2001 Shortest Prefixes
    字典树模板
    HDU 1251 统计难题
    kmp算法模板
    HDU 2087 剪花布条
  • 原文地址:https://www.cnblogs.com/longdb/p/9837313.html
Copyright © 2011-2022 走看看