• 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查询就可以如下:

  • 相关阅读:
    罗马数字转整数-算法练习
    无重复字符的最长字串-算法练习
    亲密字符串-算法刷题笔记
    0-n-1中缺失的数字-算法总结笔记
    高度检查表-算法笔记总结
    链表删除中间结点-算法练习总结
    链表中的中间结点-算法练习总结
    链表相交-算法练习总结
    多数元素-算法笔记总结
    Consul Windows集群搭建ACL Token验证
  • 原文地址:https://www.cnblogs.com/longdb/p/9837313.html
Copyright © 2020-2023  润新知