Applies ToVisio (leping 2) Visio Professional 2024 Visio Professional 2021 Visio Professional 2019 Visio Professional 2016

You can think of a view as a saved query. Views are particularly useful if you want to access the same information from multiple tables or expose data to users without letting the users change the actual tables.

Note: The Database Model diagram is only available in certain versions of Visio. See Can't find the database modeling features? for more information.

Add a view to a database model diagram

  • From the Entity Relationship or Object Relational stencil, drag a View shape onto the drawing page.

Assign columns from tables to a view

  1. Open the database model diagram that contains the view you want to add columns to.

  2. Double-click the view, and then in the Database Properties window, in the Categories list, click Columns.

  3. Do one of the following:

    • Click the Physical Name field of a blank line and type the name of the column. Repeat for each column you want to add to the view.

    • Click Add. The default name for the new column follows the naming conventions you specified in the Modeling Preferences dialog box. To change the name of the column, click the default column name and type a new name. Repeat for each column you want to add to the view.

  4. Click the name of the column whose properties you want to define, and then click Edit.

  5. In the View Column Properties dialog box, on the Source tab, click Known column in another table or view, and then click Change.

  6. In the Pick A Column dialog box, select a column from the list of tables and views in your database model diagram, and then click OK.

  7. When you are satisfied with your settings, click OK.

  8. Repeat steps 4 through 7 for each column you added in step 3.

Edit the properties of a column in a view

  1. Open the database model diagram.

  2. Double-click the view that contains the columns you want to modify, and then click Columns in the Categories list in the Database Properties window.

  3. Click the name of the column you want to modify, and then click Edit.

  4. In the View Column Properties dialog box, click the tab that contains the information you want to edit, and then make your changes.

  5. When you are satisfied with your settings, click OK.

Edit the properties of a view

  1. Open the database model diagram.

  2. Double-click the view whose properties you want to edit to open the Database Properties window.

  3. In the Database Properties window, click the category that contains the information you want to edit, and then make your changes.

The database model diagram is updated automatically.

Remove a view

  1. Open the database model diagram.

  2. On the drawing page, click the view you want to remove, and then press DELETE.

  3. In the Delete Object dialog box, do one of the following:

    • Click Yes to remove the view from the drawing page, as well as from the model and the Tables and Views window.

    • Click No to remove the view from the drawing page, but not from the model or the Tables and Views window.

Note: If you do not see the Delete Object dialog box when you delete an object from the diagram, on the Database menu, point to Options, click Modeling, and then on the Logical Diagram tab in the Database Modeling Preferences dialog box under When removing an object from the diagram, click Ask User What To Do. Alternatively, if you want to remove the view from the model, click the view in the Tables and Views window, and then press the DELETE key.

Reorder views in the Code window

  1. If the Code window is not already open, on the Database menu, point to View, and then click Code to open the window.

    Note: This command is available only in the Database Model Diagram template.

  2. Drag the view you want to reorder to a new position in the window.

Define a name space value for an entity or view

  1. Open the database model diagram.

  2. Double-click the entity or view whose name space you want to set to open the Database Properties window.

  3. In the Categories list, click Definition, and then type the distinguishing text in the Name space box.

The database model is updated automatically.

Create code for views

  1. Drag a View shape from either the Entity Relationship or Object Relational stencil.

  2. Double-click the shape to open the Database Properties window.

  3. Under Categories click SQL.

  4. Type your code into the SQL window.

Can't find the database modeling features?

It is most likely that your edition of Visio doesn't include the features you are looking for. To find out which edition of Visio you have, click About Microsoft Office Visio on the Help menu. The name of the edition is in the top line of text in the dialog box.

Visio Standard does not include the Database Model Diagram template.

Visio Professional and Premium editions support the reverse engineering features for the Database Model Diagram template (that is, using an existing database to create a model in Visio) but it does not support forward engineering (that is, using a Visio database model to generate SQL code).

Note: You can find the full suite of database modeling features, including both reverse engineering and forward engineering, in Visio for Enterprise Architects. Visio for Enterprise Architects is included in MSDN Premium Subscription, which is available with Visual Studio Professional and Visual Studio Team System role-based editions.

If you are using Visio Plan 2 and want to learn about how to engineer an existing database into a database model, see the topic, Reverse engineer an existing database.

Kas vajate veel abi?

Kas soovite rohkem valikuvariante?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.