Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating foreign key in SQL Server Management Studio

Using SQL Server 2008 R2 I am trying to establish a relationship between two companies. For the sake of illustration; one table is called 'company', another is called 'branch'. Company and branch both have primary keys. Company should relate to Branch in a one to many relationship. A row called 'branches' should be the foreign key in the table Company; linked to the primary key of the Branch table.

Naturally I go for the 'relationships' option in the Table designer menu in SSMS. But this is as far as I get.

foreign key relationships SSMS

The Tables and Columns Specification Table entries looks editable - but apparently isn't.

This is very confusing o.O Anybody know how to... edit it?

like image 411
user137263 Avatar asked Jul 24 '12 11:07

user137263


People also ask

Where is foreign key constraint in SQL Server Management Studio?

Using SQL Server Management Studio Open the Table Designer for the table containing the foreign key you want to view, right-click in the Table Designer, and choose Relationships from the shortcut menu. In the Foreign Key Relationships dialog box, select the relationship with properties you want to view.

How do I drop a foreign key in SQL Server Management Studio?

To delete a foreign key constraintIn Object Explorer, expand the table with the constraint and then expand Keys. Right-click the constraint and then click Delete. In the Delete Object dialog box, click OK.


1 Answers

Click on the ... at the right of the "Tables and Columns Specification"

like image 98
podiluska Avatar answered Sep 22 '22 14:09

podiluska