0

In MS Access I have a 'multi column - One to Many' foreign key between two table. When I try to create the same relationship in SQL Server I get a message " The columns in table 'Laser_Status_info' do not match an existing primary key or UNIQUE constraint. " Laser_Status_info already has a ID field as the primary key and I would like the user to be able to add Status info without going through the Shift Printer screen if needed.

MS Access Database diagram

enter image description here

  • A foreign key must reference a PK or a unique constraint in the parent table, as the error message says. Create a unique constraint on the FK columns. – mustaccio Feb 5 at 16:38
  • 1
    Can you post the code you're using to create the FK and the schema for both tables? Multi-column PKs and FKs are certainly valid in SQL Server, so there must be something off in the schema preventing this from working. – HandyD Feb 6 at 0:10
0

The above diagram is from MS Access. I am not sure how the FK was created. I decided to drop the relationship because I need to create Laser_Status_Info records not related to a shift log. Thanks everyone for your comments as always you are appreciated.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.