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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With