title: How do I insert into a table and get back the primary key value?
body: <p>I have a primary key set up to auto increment.</p>
  
  <p>I am doing multiple queries and I need to retrieve that primary key value to use as a foreign key in another table (<code>IsIdentity = TRUE</code>).</p>
  
  <p>Is there any elegant way to get back the primary key value when I do an insert query?  Right now I am requerying and getting the highest value in that column which seems really hacky.</p>
  
  <p>Any suggestions?</p>