title: how to get the Id of last row deleted from SQL table
body: <p>I am trying to get the last Id using max(Id) function where Id is the primary key. My code works well unless I delete last row from the table, because when I delete last row then that Id is still preserved and in that case max(Id) will retrieve the last row Id but not that Id which is deleted from the table.</p>
  
  <p>Is there any function which retrieve the last row deleted Id. I have seen some posts using <code>scope_identity()</code> and <code>@@identity</code> functions to get the current Id. I have used these functions but they are not working. I am editing my code inside a dll file may be dat is creating  problem.</p>