Could not find server 'server name' in sys.servers. SQL Server 2014

后端 未结 3 1330
迷失自我
迷失自我 2021-01-03 23:34

I recently upgraded our SQL Server from 2005 to 2014 (linked server) and I am noticing that one of the stored procedures which calls the exec command to execute a stored pro

3条回答
  •  日久生厌
    2021-01-04 00:07

    At first check out that your linked server is in the list by this query

    select name from sys.servers
    

    If it not exists then try to add to the linked server

    EXEC sp_addlinkedserver @server = 'SERVER_NAME' --or may be server ip address
    

    After that login to that linked server by

    EXEC sp_addlinkedsrvlogin 'SERVER_NAME'
                             ,'false'
                             ,NULL
                             ,'USER_NAME'
                             ,'PASSWORD'
    

    Then you can do whatever you want ,treat it like your local server

    exec [SERVER_NAME].[DATABASE_NAME].dbo.SP_NAME @sample_parameter
    

    Finally you can drop that server from linked server list by

    sp_dropserver 'SERVER_NAME', 'droplogins'
    

    If it will help you then please upvote.

提交回复
热议问题