Cannot get Linked Servers to work in Sql Azure

前端 未结 4 1509
太阳男子
太阳男子 2021-02-12 19:07

We are using a trial version of Azure. We are trying to perform cross server queries from our SQL 2012 in-house.

We seem to have our local 2012 linked with Azure. When I

4条回答
  •  迷失自我
    2021-02-12 19:58

    While adding linked server from SQL Management, you are not given option to set default database. So use something like below

    EXEC sp_addlinkedserver
    @server='name for referring locally', -- here you can specify the name of the linked server
    @srvproduct='',     
    @provider='sqlncli', -- using SQL Server native client
    @datasrc='AzureMachineName.database.windows.net',   -- add here your server name
    @location='',
    @provstr='',
    @catalog='yourdatabasename' 
    

    I figured this works.

提交回复
热议问题