title: node-mssql Transaction insert - Returning the inserted id..?
body: <p>I'm using <a href="https://github.com/patriksimek/node-mssql" rel="noreferrer"><code>node-mssql</code></a> 3.2.0 and I need to <code>INSERT INTO</code> a table and return the id of the inserted record.</p>
  
  <p>I can successfully use <a href="https://github.com/patriksimek/node-mssql#transaction" rel="noreferrer"><code>sql.Transaction()</code></a> to insert data, but the only parameters given to callbacks (<code>request.query()</code> and <code>transaction.commit()</code>) are:</p>
  
  <pre><code>const request = new sql.Request();
  request.query('...', (err, recordset, affected) =&gt; {});
  
  const transaction = new sql.Transaction();
  transaction.commit((err) =&gt; {});
  </code></pre>
  
  <p>So <code>recordset</code> is <code>undefined</code> for <code>INSERT</code>, <code>UPDATE</code> and <code>DELETE</code> statements, and <code>affected</code> is the number of rows affected, in my case <code>1</code>.</p>
  
  <p>Does anyone know a good way to obtain an inserted records id (just a primary key id) after a <code>transaction.commit()</code> using <code>node-mssql</code>..?</p>