How to get the ID of last updated Row in SQL Server 2008

sql, sql-server-2008, sql-update

Solution

You can do something like this

declare @mytable as TABLE
    (
      Id int
    )

Update Table Set Name='Nitin'
OUTPUT INSERTED.Id into @mytable
 where LastName='Varpe'

 Select Id from @mytable

Problem

I have a requirement such that I want to get the id of last updated row in a table and I want to use this id for some other operation. I don't have column like UpdatedOn , so that I can refer that column. So is there any function like scope_identity and @@identity(which gives me id of last inserted row id) for Update also. Please help me out for the same.

Original source