How to get recent updated record Id in the triggers


/ Published in: SQL
Save to your folder(s)



Copy this code and paste it in your HTML
  1. CREATE TRIGGER [dbo].[TriggerName] ON [dbo].[TableName] FOR UPDATE AS
  2.  
  3.  
  4. // DECLARE id variable FIRST;
  5.  
  6. DECLARE @ID INT
  7.  
  8. //SET it IN the BEGIN SECTION.
  9. BEGIN
  10.  
  11. SET @ID = (SELECT IssueID FROM inserted)
  12. END
  13.  
  14. *inserted IS TABLE FROM WHERE we are querying the LAST updated id.

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.