Sql-Server

SSMS Designer 刪除方括號

  • December 18, 2019

我正在設計一個訪問連結伺服器中的表的視圖。

每次我將此查詢粘貼到 SQL 窗格中時,Intellisense 都會刪除方括號,然後抱怨有超過 3 個前綴。我試過關閉 Intellisense,但它一直在發生:

SELECT   Loc.Address1, Loc.Address2, Loc.Address3, BP.BusinessPartnerName
FROM     [REPORTING.SOMESERVER.CA].Toast.dbo.BusinessPartnerLocations AS Loc LEFT OUTER JOIN
        [REPORTING.SOMESERVER.CA].Toast.dbo.BusinessPartner AS BP ON Loc.BusinessPartnerID = BP.BusinessPartnerID

對此:

SELECT   Loc.Address1, Loc.Address2, Loc.Address3, BP.BusinessPartnerName
FROM     REPORTING.SOMESERVER.CA.Toast.dbo.BusinessPartnerLocations AS Loc LEFT OUTER JOIN
        REPORTING.SOMESERVER.CA.Toast.dbo.BusinessPartner AS BP ON Loc.BusinessPartnerID = BP.BusinessPartnerID

錯誤資訊

似乎將伺服器名稱封裝在引號中會使 Intellisense 忽略它。

FROM        ["REPORTING.SOMESERVER.CA"].Toast.dbo.BusinessPartnerLocations AS Loc LEFT OUTER JOIN

引用自:https://serverfault.com/questions/995949