In the SQL builder, you can add one or more table references to
an SQL statement, depending on the type of statement that you are creating.
Table references are objects such as tables and views that you
can include in an SQL statement. You can add table references at any time
while you are working on the statement.
You can create an SQL statement
with multiple table references by using SELECT, FULLSELECT, and WITH statements.
INSERT, UPDATE, and DELETE statements operate on a single table reference.
You
can add table references directly in the Tables pane, or by dragging them
to the Tables pane. You can drag a table reference from a database in a database
connection in the Database Explorer view. You can
also drag a table reference from a physical data model in a data project
in the Data Project Explorer view.
Prerequisites:- The SQL statement must be open in the SQL builder.
- If you are dragging a table reference from a database, its database connection
must be active.
- If you are dragging a table reference from a physical
data model, the model must exist in a data design project.
To add a table reference to an SQL statement in the SQL builder:
- Add the table reference directly in the Tables pane or drag it
to the Tables pane:
|
|
To add a table reference directly in the Tables pane |
- Right-click in the Tables pane of the SQL builder, and then click Add
Table on the pop-up menu.
- In the Table name list, expand a schema, and then
click the table reference to add.
- If a table reference with the same name already exists in the statement,
specify an alias.
- Click OK.
|
To drag a table reference from a database |
- In the Database Explorer view, expand the database connection.
- Expand the database, expand the Schemas folder,
and then expand a schema.
- Expand the folder in the schema that contains the table reference to add,
and then drag the table reference to the Tables pane.
|
To drag a table reference from a physical
data model |
- In the Data Project Explorer view, expand a data design project that contains
the physical data model, and then expand the Data Models folder.
- Double-click the physical data model (.dbm) file to open it.
- In the Data Project Explorer view, expand a schema that is in the physical
data model.
- Drag the table reference that is in the schema to the Tables pane.
|
- Optional: If you dragged a table reference, specify an alias.
- In the Tables pane, right-click the table reference, and then
click Update Alias on the pop-up menu.
- In the Change Table Alias window, type an alias and then click OK.
The table reference is added to the Tables pane and is reflected
in the SQL Source pane.
If you rearrange the table graphics in the Tables
pane and then save the SQL statement, the arrangement of the table graphics
reverts to the linear format, and the order of the table graphics reverts
to their order in the SQL statement.