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

SQL Anywhere 11.0.1 » SQL Anywhere Server - Database Administration » Administering Your Database » SQL Anywhere graphical administration tools » Using Interactive SQL » Executing SQL statements from Interactive SQL

 

Recalling commands

When you execute a command, Interactive SQL automatically saves it in a history list that persists between Interactive SQL sessions. Interactive SQL maintains a record of up to 50 of the most recent commands.

You can view the entire list of commands in the Command History window. To access the Command History window, press Ctrl+H, or click the Open A List Of Past SQL Statements button on the toolbar.

The Interactive SQL Command History window.

The most recent commands appear at the bottom of the list. To recall a command, select it and then click OK. It appears in the SQL Statements pane of Interactive SQL. You can select multiple commands from the Command History window.

You can also recall commands without the Command History window. Use the Recall Previous SQL Statement and Recall Next SQL Statement icons in the toolbar to scroll back and forward through your commands, or press Alt+Right Arrow and Alt+Left Arrow, respectively.

Note

If you execute a SQL statement that contains password information (CREATE USER, GRANT REMOTE DBA, CONNECT, or CREATE EXTERNLOGIN), the password information appears in the Command History window for the duration of the current Interactive SQL session.

When the command history is viewed in subsequent Interactive SQL sessions, passwords are replaced with ... in any of these statements that contain password information. For example, if you execute the following statement in Interactive SQL:

CREATE USER testuser
 IDENTIFIED BY testpassword;

the following statement appears in the Command History window in subsequent Interactive SQL sessions:

CREATE USER testuser
 IDENTIFIED BY ...;
Copying commands from the Command History window

You can copy commands from the Command History window to use elsewhere. When you copy multiple commands, they are separated by the command delimiter (a semicolon by default).

To copy commands from the Command History window
  1. Open the Command History window.

  2. Select the command or commands, and then press Ctrl+C or click Copy.

  3. Click OK to copy the selected statements to the SQL Statements pane of Interactive SQL.

Saving commands from the Command History window

You can also save commands in text files so that you can use them in a subsequent Interactive SQL session.

To save the command history to a file
  1. Open the Command History window.

  2. Click the Save History As .SQL File button or press Ctrl+S.

  3. In the Save As window, specify a location and name for the file.

    The command history file has a .sql extension.

  4. Click Save when finished.

Removing commands from the Command History window

The contents of the Command History window persist between Interactive SQL sessions. You can remove commands from the history in one of two ways:

  • Select one or more commands and click the Delete button or press the Delete key to remove the selected command(s) from the window. This action cannot be undone.

  • Remove all the commands from the window by clicking Clear History. This action cannot be undone.