Dejan Stuparic
Dejan Stuparic

Reputation: 595

How to set referential integrity rules in Microsoft SQL Server Management Studio 2008

I am new with Management Studio. I built relation between these two tables, but how to set integrity rules on them, like many-to-one, or many-to-many?

tables http://www.imageupload.org/thumb/thumb_98396.png

http://www.imageupload.org/?d=5862C4631 here is download link for pictre.

Upvotes: 2

Views: 2914

Answers (1)

PaulStock
PaulStock

Reputation: 11283

When you create the link between columns, the relationship dialog that appears will allow you to specify which table is the Primary key table and which is the foreign key table. The primary key table is the "One" the foreign key table is the "Many".

In the diagram you provided, the Key icon shows which side is the "One" while the infinity icon shows which side is the "Many"

enter image description here

I don't think you can create a many-to-many relationship directly between two tables. In order to do that you have to create an intermediate table that sits between the two related tables.

Upvotes: 2

Related Questions