How to: Add Tables to Diagrams
You can add a table to your database diagram to edit its structure or relate it to other tables in your diagram. You can either add existing database tables to a diagram or insert a new table that has not yet been defined in the database.
Note
Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Customizing Development Settings in Visual Studio.
To insert a new table into a diagram
Make sure you are connected to the database in which you want to create the table.
To create a table in your current diagram, click the New Table button on the toolbar.
–or–
Right-click in the diagram and select New Table.
Modify or accept the system-assigned table name, in the Choose Name dialog box, and then choose OK.
A new table appears in the diagram in Standard view.
In the first cell of the new table, type a column name. Then press the TAB key to move to the next cell.
Under Data Type, select a data type for the column. Each column must have a name and data type.
You can set the column's other properties in Table Designer. For more information see Modifying Columns (Visual Database Tools).
Repeat steps 3 and 4 for each column you want to add to the table.
Note
When you save your database diagram, the new table will be added to your database.
To add an existing table to a diagram
Make sure you are connected to the database whose tables you want to edit.
Select a table in the Tables folder.
Drag the table into your database diagram.
Release the mouse button.
Note
If relationships exist between the selected table and other tables in your diagram, relationship lines are automatically drawn.
To add related tables to a diagram
Select one or more tables with foreign key constraints in the database diagram.
Right-click any of the selected tables and choose Add Related Tables.
Note
Both those tables referenced by a foreign key constraint from the selected table(s) and those referencing the selected table(s) with a foreign key constraint are added to the diagram.