title: Execute query to linked server as another user
body: <p>I'd like to execute a query which uses linked server as a specific user. However, not even a simple example works.</p>
  
  <p>When I opem SSMS as user "domain\user", connect to "serverA" and run following code:</p>
  
  <pre><code>EXECUTE ('SELECT col FROM serverB.dbB.dbo.table')
  </code></pre>
  
  <p>it works fine.</p>
  
  <p>However, when I opem SSMS as user "domain\admin", connect to "serverA" and run following code:</p>
  
  <pre><code>EXECUTE ('SELECT col FROM serverB.dbB.dbo.table') AS LOGIN = 'domain\user'
  </code></pre>
  
  <p>It throws following error:</p>
  
  <blockquote>
    <p>Linked servers cannot be used under impersonation without a mapping for the impersonated login.</p>
  </blockquote>
  
  <p>I've googled a lot, but haven't found any solution. Does anybody know where the problem can be?</p>