title: How to get the value of autoincrement of last row at the insert
body: <p>I have googled this problem one week and no thing useful I think am not using the correct word</p>
  
  <p>I am using SQL Server 2008 with t-sql and my need is to optimise my function when I insert a new row.</p>
  
  <p>I have a table with first column is the key of integer autoincrement type and other columns are just for information</p>
  
  <p>When we do an insert, SQL Server increments the key automatically and I have to do a select max to get the value, so is there a way like a global variable like <code>@@IDENTITY</code> or a function to avoid the begin end transaction and select max </p>