Sql Trigger After Insert Update Another Table With Conditions
I am creating After Insert trigger , its working fine, but I have certain conditions before executing the statements inside the trigger Based on Different CustomerId Run the trig
Solution 1:
What you're looking for here is the inserted table. Every time you issue an UPDATE statement, SQL Server generates two virtual tables called inserted and deleted that store information on the data modifications you're making. These tables are accessible from your trigger. For more information, see here: https://msdn.microsoft.com/en-us/library/ms191300.aspx
You can use inserted to get the IDs you're looking for. So, instead of:
WHERE ClaimCustomerId=1you can use:
WHERE ClaimCustomerId=inserted.ClaimCustomerId
Post a Comment for "Sql Trigger After Insert Update Another Table With Conditions"