## Creating and Executing SQL Statements

### Use

In the SQL dialog, you can create and save SQL statements in a number of different modes.

### Procedure

1. Choose View ® SQL Dialog. The system opens a window for the SQL dialog.

2. The default values that you set in the user settings are used for the SQL mode and the isolation level. If you want to use different values, select a different SQL mode and isolation level in the lower part of the dialog box.

If you log on to a database instance (version 7.6 or higher) with SQL Studio, you can only choose the SQL modes INTERNAL or ORACLE. The SQL modes DB2 and ANSI are no longer supported.

3. You can also change the commit mode in the lower part of the dialog box.

If you have the user attribute EXCLUSIVE, you can select the mode Auto Commit: ON only. For an explanation of the user attributes, see the authorization section of the SQL Reference Manual.

4. Enter your SQL statements.

You can add SQL statements that were already executed during the current database session. Choose SQL Dialog ® Recent Statements. Select the required statement, and choose Get.

The keyword list also supports you in creating SQL statements.

5. To comment out a row, use // or ––at the start of the row.

6. To separate several SQL statements from one another, enter a commented-out separator line.

7. To scroll through the statement history of the database session, choose SQL Dialog ® Previous Statement or SQL Dialog ® Next Statement.

8. You can set parameters for SQL statements.

9. To use or edit your SQL statements again later, save them as SQL Studio objects by choosing SQL Dialog ® Save As.

10. To execute the SQL statements, choose SQL Dialog ® Execute. If you only want to execute some of the displayed SQL statements, select the section that you want to execute and choose SQL Dialog® Execute.

### Result

The status line of the statement window indicates whether your SQL statements were executed successfully. If an error occurred, an error message is displayed in the status window of the SQL Studio. Depending on your settings, additional information such as the time it took to execute your SQL statements is also displayed there.

If your SQL statement returns a result table, this is displayed in a separate window.