How do I create and query linked database servers in SQL Server?

前端 未结 4 1290

I need to do a join across two different database servers (IPs 10.0.0.50 and 10.0.0.51). What\'s the best way?

4条回答
  •  长情又很酷
    2020-12-03 02:17

    The solution I found:

    1) Run a stored proc

    exec sp_addlinkedserver    @server='10.0.0.51'
    

    2) Verify that the servers were linked (lists linked servers)

    exec sp_linkedservers
    

    3) Run the query using the format

     [10.0.0.51].DatabaseName.dbo.TableName
    

提交回复
热议问题