title: Linked Server Query works, but OPENQUERY of same produces error "Could not find server 'SERVER' in sys.servers
body: <p>Looking for pointers on how to resolve this issue.</p>
  
  <p>I have a linked server setup. 
  This query works in SSMS, I get rows back.</p>
  
  <pre><code>SELECT tbl.[Col1]
        ,tbl.[CoL2]
    FROM [LINKEDSERVER].[CATALOG].[SCHEMA].[TABLENAME] tbl
  </code></pre>
  
  <p>But trying to do the same in SSMS with OPENQUERY fails</p>
  
  <pre><code>SELECT [Col1]
  FROM OPENQUERY([LINKEDSERVER],
  'SELECT tbl.[Col1]
        ,tbl.[CoL2]
    FROM [LINKEDSERVER].[CATALOG].[SCHEMA].[TABLENAME] tbl'
  ) As Whatever
  </code></pre>
  
  <p>The messages are as follows:</p>
  
  <blockquote>
    <p>OLE DB provider "SQLNCLI11" for linked server "SERVER" returned
    message "Deferred prepare could not be completed.". Msg 8180, Level
    16, State 1, Line 1 Statement(s) could not be prepared. Msg 7202,
    Level 11, State 2, Line 1 Could not find server 'SERVER' in
    sys.servers. Verify that the correct server name was specified. If
    necessary, execute the stored procedure sp_addlinkedserver to add the
    server to sys.servers.</p>
  </blockquote>
  
  <p>The server name SERVER does appear when I check   <code>select * from sys.servers</code> 
  OPENQUERY from here against other linked servers is successful.</p>