Link to home
Start Free TrialLog in
Avatar of pdvsa
pdvsaFlag for United States of America

asked on

Update query help

Experts,

I have the below SQL.
I need to update blLetterOfCredit.[GuaranteeCode]  to the value in Import-csm.[Guarantor Code]
I think I have it right but it gives me an error that basically says it cant update due to key violations.

Import-csm.[Guarantor Code] and tblLetterOfCredit.GuaranteeCode are both the same property in the tables as Double, General Number and Indexed No duplicates.  I initially had Import-csm.[Guarantor Code] as a Primary Key thinking that might be the issue but I removed it and still have the same error.  

What do you think could be the cause of this error?  

here is the SQL:
UPDATE [Import-CSM] INNER JOIN tblLetterOfCredit ON [Import-CSM].[Reference Number] = tblLetterOfCredit.LCNo SET tblLetterOfCredit.GuaranteeCode = [Guarantor Code];
 User generated image User generated image
Avatar of pdvsa
pdvsa
Flag of United States of America image

ASKER

and they are both number fields.  
Is  tblLetterOfCredit.GuaranteeCode involved in any indexes that may be defined as unique?
ASKER CERTIFIED SOLUTION
Avatar of Bill Ross
Bill Ross
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Specifically check for duplicate [Import-CSM].[Reference Number]  or tblLetterOfCredit.LCNo.  If either of these tables contain duplicates the the update will fail since there is more than one match in the inner join.
Avatar of pdvsa

ASKER

darn duplicates.   thx