title: Can't select from sys.extended_properties using PHP PDO
body: <p>When querying a SQL Server database from PHP with this statement:</p>
  
  <pre><code>SELECT [Value] FROM sys.extended_properties WHERE name='MS_Description'
  </code></pre>
  
  <p>I get this error message:</p>
  
  <blockquote>
    <p>"Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[IMSSP]: Invalid type.' in C:\inetpub\wwwroot\index.php:104 Stack trace: #0 C:\inetpub\wwwroot\index.php(104): PDOStatement->fetch(2) #1 {main} thrown in C:\inetpub\wwwroot\index.php on line 104"</p>
  </blockquote>
  
  <p>The php that I'm using is below, line 104 is the start of the While loop:</p>
  
  <pre><code>$sql = "SELECT [Value] FROM sys.extended_properties WHERE name='MS_Description'";
  global $pdo;
  $qry = $pdo-&gt;query($sql);
  if (!$qry) {
      exit('&lt;pre&gt;' . print_r($qry-&gt;errorInfo()));
  }
  while($row = $qry-&gt;fetch(PDO::FETCH_ASSOC)) {
      foreach ($row as $key =&gt; $value) {
          echo '&lt;p&gt;Key: ' .$key. ', Value: ' .$value. '&lt;/p&gt;';
      }
  }
  </code></pre>
  
  <p>The code above works fine when selecting from any other table or view e.g:</p>
  
  <pre><code>SELECT * FROM sys.events
  </code></pre>
  
  <p>If I execute the statement via SSMS it works fine, any ideas why it doesn't work via PHP?</p>