Richard   Housham
Richard Housham

Reputation: 1680

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.

Upvotes: 0

Views: 139

Answers (1)

Tab Alleman
Tab Alleman

Reputation: 31775

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.

Upvotes: 1

Related Questions