title: Not getting err code,type and state with Perl DBI (DBD::ODBC) on Sqlserver
body: <p>I have a perl script which does the below to just run a insert stmnt and doing a deliberate RAISERROR. Now i can see that the error is generated but has the wrong error code - SQL-42000 , but the error diagnostic methods don't return anything. Using $DBI::err,$DBI::errstr,$DBI::state also doesnt print the correct thing. Only $DBI::errstr is coming up correctly.</p>
  
  <pre><code>$dbh-&gt;{RaiseError} = 1;
  $dbh-&gt;{PrintError} = 1;
  
  $dbh-&gt;begin_work;
  eval {
        $dbh-&gt;do(INSERT INTO ..);
        $dbh-&gt;do (RAISERROR ('User defined error',16,1) --purposely raising error
        $dbh-&gt;commit;
        1;
  };
       if ($@) {
       print $@;
       print "err() ==&gt;".$dbh-&gt;err();
       print "errstr() ==&gt;".$dbh-&gt;errstr();
       print "state() ==&gt;".$dbh-&gt;state();
       $dbh-&gt;rollback or warn "rollback failed";
  }
  </code></pre>
  
  <p><strong>Output:</strong></p>
  
  <pre><code>DBD::ODBC::db do failed: [unixODBC][FreeTDS][SQL Server]User defined error (SQL-42000) ..
  err() =&gt;
  errstr() =&gt;
  state() =&gt;
  </code></pre>