Link to home
Start Free TrialLog in
Avatar of nicepaktech

asked on

Creating Trigger in SQL 2008 R2 using Composite Keys on Unrelated Tables

I have been tasked with creating a trigger that will update a column named trans_flag based upon conditions of the inserted row’s columns matching another table’s columns.
The problem is that these two tables do not have a straightforward foreign key relationship between them.  Both tables have a 5-part key (consisting of 5 columns) that make the rows unique, and if all 5 of those keys match, I have to change the trans_flag column on one table, and another column on the other table.
I am not sure where I can even begin with coding this, as I have never dealt with a composite key situation like this before.
Can anyone get me started with how to check for the 5-key column match?

Avatar of Scott Pletcher
Scott Pletcher
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial