Modifying SQL and XQuery statements in the SQL and XQuery editor

You can modify existing SQL statements and XQuery statements in the SQL and XQuery editor.

Before you begin

The SQL statement or XQuery statement must exist in a data project in the Data Project Explorer view. In a data design project, the SQL statement can be located in either the SQL Scripts folder or the SQL Statements folder in a physical data model.

About this task

You can use the SQL and XQuery editor to modify SQL statements that you specified in the SQL Query Builder and SQL and XQuery statements that you created in the SQL and XQuery editor.

Procedure

To modify an SQL statement or XQuery statement in the SQL and XQuery editor:

  1. In the Data Project Explorer view, expand a data project.
  2. Expand the folder that contains the statement to edit. Perform one of the following steps:
    • Expand the SQL Scripts folder in the data project.
    • In a data design project that contains a physical data model, expand the Data Models folder. Double-click a physical data model (.dbm) file to open it. Expand the physical data model, the database, and the SQL Statements folder.
  3. Right-click the statement or script that you want to edit, and then select Open With > SQL and XQuery Editor. Select the statement terminator that you use to denote the end of an SQL statement. The statement opens in the SQL and XQuery editor.
  4. Edit the SQL or XQuery statement.
  5. Optional: To establish or change the database connection that is associated with the statement, click the No Connection link at the top of the editor view. Use the Select Connection Profile wizard to select or create a connection profile to connect to the target database. The connection information appears at the top of the editor view, in an expandable pane.
  6. Optional: To insert the code pattern of a template into your statement, at the insertion point, type the first few characters of the template name, press Ctrl + Space, and then select the template in content assist.
  7. Optional: To format your SQL or XQuery code, right-click in the editor, and then click Format SQL.
  8. Save the changes that you have made.
    • If you are modifying an SQL statement that is in an SQL Scripts folder in a data project, save the statement.
    • If you are modifying an SQL statement that is in a physical data model, save the physical data model. When you save the physical data model, you save all the data objects in the physical data model that have outstanding changes.

Feedback