Posted By

kashif21 on 04/22/11


Tagged

triggers


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Beppoi


How to get recent updated record Id in the triggers


 / Published in: SQL
 

  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  

You need to login to post a comment.