title: Executing sys.xp_readerrorlog with OPENROWSET
body: <p>The following runs successfully: </p>
  
  <pre><code>EXEC sys.xp_readerrorlog 0
  </code></pre>
  
  <p>This however does not:</p>
  
  <pre><code>SELECT * 
  FROM OPENROWSET(
      'SQLNCLI', 
      'Server=.;Trusted_Connection=Yes;',
      'EXEC sys.xp_readerrorlog 0')
  </code></pre>
  
  <p>I am logged in using my Windows account and I have <code>sysadmin</code> permissions on all databases on my local server, including the system databases.</p>
  
  <p>Here is the error message:</p>
  
  <blockquote>
    <p>Msg 7357, Level 16, State 2, Line 11<br>
    Cannot process the object "EXEC sys.xp_readerrorlog 0". The OLE DB provider "SQLNCLI10" for linked
    server "(null)" indicates that either the object has no columns or the
    current user does not have permissions on that object.</p>
  </blockquote>
  
  <p>I've checked the folder permissions on <strong><code>C:\Windows\ServiceProfiles\LocalService\AppData</code></strong> just in case that it was an issue with <code>OPENROWSET</code> creating a temp file but local administrators (I'm in the group) have full control.</p>
  
  <p>Why am I getting this error and how can I get around it?</p>