Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Database Diagram visually show Foreign Keys in Management Studio?

I'm reviewing this database and creating the foreign keys, believe me they did not exist. I'm using SSMS to visually let me know what foreign keys are missing and also create them. Is there any configuration to let the diagram designer show if a specific column is already part of a foreign key? That would help me identify missing FKs faster.

This is how it's showed currently:

Current

This is what I'm looking for (or something like that):

Desired

I just need some visual indicator (like I've seen in other tools) that shows me if a column is part of a FK.

like image 968
Adriano Carneiro Avatar asked Apr 12 '11 21:04

Adriano Carneiro


People also ask

How show foreign key data in SQL?

To retrieve data from both table associated with foreign key i.e(common column) you have to join both the tables. if you matching data from both table then use INNER JOIN. >

Can we create foreign key on view?

In the strict sense of the word, no you cannot set foreign keys on views.


1 Answers

I know this is an old post but this may help others.

within SSMS Database Diagram by right-clicking a table > then select "table view" > then select "keys" this will only show PK and FK and all other keys in that table. OK you say you need it on all tables that's fine in within SSMS Database Diagram click the background (with no items selected) then press "Ctrl+A" to select all then with your mouse over a selected table right-clicking > then select "table view" > then select "keys" this will show PK and FK and all other keys in each selected tables. then if you need to see the full set of column names for a given table you can change the "table view" for that one and change it back.

This way you see what has and what has not got FK ...

Hope this helps others like it has me.

like image 78
Simon 5968 Avatar answered Nov 16 '22 01:11

Simon 5968