Add database objects to a diagram

You can populate a diagram by adding existing database objects or by creating objects on the diagram.

You can add the following object types to a diagram:

  • Tables
  • Views
  • Stored procedures
  • Functions

Add existing objects to a diagram

You can add an object to a diagram in one of these ways:

  • From Database Explorer, drag the object to the diagram.

  • In Database Explorer, right-click the object and select Send to > Database Diagram.

To add multiple objects to a diagram:

1. In Database Explorer, select the objects you want to add:

  • To select a range of objects, click the first object, hold Shift, and click the last object.

  • To select individual objects, hold Ctrl and click each object you want to add.

2. Add the selected objects to the diagram:

  • Drag the objects to the diagram.

  • Right-click the selected objects and select Send to > Database Diagram.

To add all database objects, drag the database node to the diagram.

Note

  • You can only add objects from the same database connection.
  • When you add two tables that share a foreign key, the relationship is displayed on the diagram automatically.

Create an object on the diagram

1. On the Database Diagram toolbar, select an object type.

Object type icons on the Database Diagram toolbar

Alternatively, right-click the diagram and select New, then select the object type.

2. In the editor, specify the object properties.

Note

The properties you need to specify depend on the object type. For more information about editing objects, see:

  • Table Designer
  • View Designer
  • Procedure Designer
  • Function Designer

3. Save the object, then close the editor.

The table object editor with object details specified and the Apply button highlighted

Tip

You can also add notes, containers, and images to the diagram. For more information, see Create additional elements on a diagram.

After adding objects to a diagram, you can define relationships, edit object details, or remove objects from the diagram.