Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 12.0.1 » SQL Anywhere Server - Database Administration » Database administration » SQL Anywhere graphical administration tools » Interactive SQL


Executing SQL statements in Interactive SQL

One of the primary uses of Interactive SQL is to browse table data. Interactive SQL retrieves information by sending a request to your database server. The database server, in turn, looks up the information, and returns it to Interactive SQL.

After you execute a SELECT statement, the result set appears on the Results tab in the Results pane. By default, row numbers appear to the left of the result set.


The database server creates schema locks on tables that you view in Interactive SQL, even if you do not modify the table.

However, you can configure Interactive SQL to attempt to release the database schema locks it creates when it displays your result set. To do so, in Interactive SQL, click Tools » Options » SQL Anywhere, and click Automatically Release Database Locks.

When this option is selected, after you execute a statement that returns a result set, Interactive SQL checks if your connection has any uncommitted changes in the database. If none exist, then Interactive SQL releases your schema locks; otherwise, Interactive SQL does not release your schema locks. That is, Interactive SQL does not release your schema locks if you have any uncommitted changes to the database.

 Execute all SQL statements
  1. Type your query in the SQL Statements pane.

  2. Press F5, or click SQL » Execute to execute the statement.

 Execute selected SQL statements
  1. Type your queries in the SQL Statements pane and select the query.

  2. Press F9, or click SQL » Execute Selection to execute the statement.

To execute SQL statements individually, for example when debugging, you can click SQL » Single Step. Single Step executes a specified statement and then selects the next statement to be executed. To execute the next statement, run Single Step again.

 Execute SQL statements one at a time
  1. Type your queries in the SQL Statements pane.

  2. Place your cursor in the statement that you want to execute.

  3. Click SQL » Single Step, or press Shift+F9 to execute the specified statement.

    When the SQL statement executes, the next SQL statement is selected.

  4. To execute the selected SQL statement, press Shift+F9.

  5. Repeat the previous step until there are no more selected statements to execute.

You can also click the Execute Statements button to execute the statements in the SQL Statements pane. This button can be set to execute all SQL statements or only execute the selected statements.

 Configuring the Execute Statements toolbar button
  1. Click Tools » Options.

  2. Click Toolbar:

    To execute all SQL statements, click Execute. This is the default setting.

    To execute only the selected SQL statements, click Execute Selection.

 See also

Inserting comments in Interactive SQL
Indenting SQL statements in Interactive SQL