SQL - Connect to Linked Server with Named Instance

后端 未结 3 2239
借酒劲吻你
借酒劲吻你 2020-12-19 20:35

How do I connect to a named instance of a linked SQL server.

If its not linked, I would do the following:

ServerName.DatabaseName.dbo.TableName


        
相关标签:
3条回答
  • 2020-12-19 20:39

    Check this

    You can surround server name with brackets

    0 讨论(0)
  • 2020-12-19 20:39

    the correct syntax is [ServerName\InstanceName].DatabaseName.dbo.TableName.

    0 讨论(0)
  • 2020-12-19 21:02

    If you are using the default instance, you don't need to specify the instance name.

    Example using the default instance: [MyServer].[MyDatabase].[MySchema].[MyTable]

    NB: If you don't know your schema name, give [dbo] a try, since that is the default schema.

    So something like this should work for you

    SELECT *
    FROM [MyTable] t
    INNER JOIN [MyLinkedServer].[MyLinkedDatabase].[MyLinkedSchema].[MyLinkedTable] lt ON lt.Id = t.Id
    
    0 讨论(0)
提交回复
热议问题