title: Equivalent of mysql_insert_id() for ms sql server
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/45651/sql-how-to-get-the-id-of-values-i-just-inserted">SQL: How to get the id of values I just INSERTed?</a>  </p>
  </blockquote>
  
  
  
  <p>For PHP, What's equivalent of <code>mysql_insert_id()</code> for sql server 2012?</p>
  
  <p><code>sqlsrv_insert_id()</code> does not seem to exist.</p>
  
  <p>Say this is the code</p>
  
  <pre><code>  if ($result) {
              // get user details 
              $uid = mysql_insert_id(); // last inserted id
              $result = mysql_query("SELECT * FROM users WHERE uid = $uid");
              // return user details
              return mysql_fetch_array($result);
          } else {
              return false;
          }
  </code></pre>
  
  <p>for mysql,
  how should I do it for sql server?</p>