0

I am designing a view that accesses tables in a linked server.

Every time I paste this query into the SQL pane, Intellisense removes the square brackets, and then complains that there's more than 3 prefixes. I've tried turning Intellisense off, but it keeps happening:

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

to this:

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

Error Message

Izzy
  • 8,224
  • 2
  • 31
  • 35
  • 1
    Why are you using the Query Designer? If you paste your query into a standard query window, SSMS won't rewrite it. – Doug Deden Dec 18 '19 at 21:20
  • 1
    As a workaround, I find that it I just throw an extra period at the end of your query, the Query Designer fails to parse it, and gives me the opportunity to click Ignore. That seems to prevent any optimization, and then I can just remove the extra period once it ends up in the normal query window. – Doug Deden Dec 18 '19 at 21:22
  • Sorry, should have mentioned I'm designing a new view. I'm a Mongo guy these days, so wrapping my head around SQL again – Izzy Dec 18 '19 at 21:32

1 Answers1

1

It seems that encapsulating the server name in quotes made Intellisense ignore it.

FROM        ["REPORTING.SOMESERVER.CA"].Toast.dbo.BusinessPartnerLocations AS Loc LEFT OUTER JOIN
Izzy
  • 8,224
  • 2
  • 31
  • 35