Create View using Linked Server db in SQL Server

前端 未结 7 757
醉酒成梦
醉酒成梦 2020-12-30 04:06

How can I create View on Linked Server db. For Example I have a linked server [1.2.3.4] on [5.6.7.8]. Both db servers are SQL Sserver 2005. I want to create View on [5.6.7.8

7条回答
  •  無奈伤痛
    2020-12-30 04:53

    your main problem is naming your Link Server with numbers (IP address). The only way that worked for me was using an alphabetical name for my Link Server without any dot '.' You can use these lines of code to add your link server and authentication:

        EXEC sp_addlinkedserver   
            @server='TEST_LINK', 
            @srvproduct='',
            @provider='SQLNCLI', 
            @datasrc='tcp:0.0.0.0'
    
        EXEC sp_addlinkedsrvlogin
            @useself='FALSE',
            @rmtsrvname='TEST_LINK',
            @rmtuser='user',
            @rmtpassword='secret'
    

    You can find the original answer here

提交回复
热议问题