简体   繁体   中英

How to add in a relationship in sql management studio with 2 fields

Hi right I'm just creating the foriegn keys/relationships in sql server management studio, but I've come across a bit of a problem. I have several tables lets call them

my_form1, 
my_form2, 
my_form3

When filling out any of these 'my_forms' I keep a record of that. In another table lets call that 'forms' In forms I have these fields

form_id
form_type - I store the type of form (1,2,3)
myform_id - I store the id of the form.

How do I correctly show this on my sql server management relationship.

I've cut down the problem and there are obviously more fields but the situation is the same.

This kind of relationship can't be enforced with a simple foreign key, and therefore won't show up on a diagram generated with SSMS.

You can create your own diagram in Visio and draw it there. I believe this is what is called a " Subtype " entity relationship.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM