SQL – Connect to Linked Server with Named Instance

SQL – Connect to Linked Server with Named Instance

臻嫒无言 发布于 2021-11-29 字数 386 浏览 786 回复 3 原文

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

If its not linked, I would do the following:


If it is linked, I would assume the following:


but SQL doesn't like the ""

What is the correct syntax

如果你对这篇文章有疑问,欢迎到本站 社区 发帖提问或使用手Q扫描下方二维码加群参与讨论,获取更多帮助。



需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。


弃爱 2022-06-07 3 楼

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

Example using the default instance:

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

FROM [MyTable] t
INNER JOIN [MyLinkedServer].[MyLinkedDatabase].[MyLinkedSchema].[MyLinkedTable] lt ON lt.Id = t.Id
别在捏我脸啦 2022-06-07 2 楼

the correct syntax is [ServerNameInstanceName].DatabaseName.dbo.TableName.

蓝戈者 2022-06-07 1 楼

Check this

You can surround server name with brackets