How to add a table or table-valued object to a query in the Diagram Pane in SQL server

When developers create a query, they are retrieving data from a table or other objects structured like tables — views and certain user-defined functions. To work with any of these objects in their query, they add them to the Diagram Pane.When developers working with SQL Server “Denali”, MS SQL Server 2008 R2 and MS SQL Server 2005 want to  add a table or table-valued object to a query, they should follow the next steps:

1. In the Diagram pane of the Query and View Designer, right-click the background and choose Add Table from the shortcut menu.

2. In the Add Table dialog box, select the tab for the type of object they want to add to the query.

3. In the list of items, double-click each item they want to add.

4. When they finish adding items, click Close.

The Query and View Designer updates the Diagram Pane, Criteria Pane, and SQL Pane accordingly.

Notes:

– Tables and views are automatically added to the query when developer references them in the statement in the SQL pane.

– The Query and View Designer will not display data columns for a table or table-structured object if developer does not have sufficient access rights to it or if the provider cannot return information about it. In such cases, only a title bar and the * (All Columns) check box are displayed for the table or table-valued object.