benjamenus
Programmer
I have two tables, (simplified) structure as below
tblClient
Client -- unique index
AL_User -- can be null
WC_User -- can be null
GL_User -- can be null
tblClaim
ClaimID -- unique index
Client
Code -- always AL, GL or WC
User
they link as follows
tblClient.Client=tblClaim.Client
What I would like to do is this ...
When someone updates a record in tblClaim, I want tblClaim.User to be updated with the appropriate user from tblClient (but only if the user in tblClient is not null). For example, if the tblClaim.Code='AL' then tblClaim.User=tblClient.AL_User (so long as AL_User is not null).
I'm not sure of the best way to achieve this. It would be quite eay to do with a weekly update and some simple SQL, but this isn't really practical due to the number or records involved and also the time lag. I don't believe I can just use an After Update trigger on tblClaim as I can't update the record I'm referencing (is this correct?). So, one idea is to use an After Update trigger to test the values and if an update is required, call a stored proc to update that record in tblClaim (will this work?).
Any ideas/advice very welcome
Cheers
tblClient
Client -- unique index
AL_User -- can be null
WC_User -- can be null
GL_User -- can be null
tblClaim
ClaimID -- unique index
Client
Code -- always AL, GL or WC
User
they link as follows
tblClient.Client=tblClaim.Client
What I would like to do is this ...
When someone updates a record in tblClaim, I want tblClaim.User to be updated with the appropriate user from tblClient (but only if the user in tblClient is not null). For example, if the tblClaim.Code='AL' then tblClaim.User=tblClient.AL_User (so long as AL_User is not null).
I'm not sure of the best way to achieve this. It would be quite eay to do with a weekly update and some simple SQL, but this isn't really practical due to the number or records involved and also the time lag. I don't believe I can just use an After Update trigger on tblClaim as I can't update the record I'm referencing (is this correct?). So, one idea is to use an After Update trigger to test the values and if an update is required, call a stored proc to update that record in tblClaim (will this work?).
Any ideas/advice very welcome
Cheers