Interactive isql Commands

To use isql interactively, give the command isql (and any of the optional parameters) at your operating system prompt.

The isql program accepts SQL commands and sends them to the SAP ASE server. The results are formatted and printed on standard output. Exit isql with quit or exit.

When using isql interactively:
  • Read an operating system file into the command buffer using:
    :r filename
    Do not include a command terminator in the file; enter the terminator interactively once you have finished editing.
  • Read and display an operating system file into the command buffer using:
    :R filename
  • You can change the current database using:
    use databasename

The commands you execute from within interactive isql are:

CommandDescription
:r filename

Reads an operating system file into the command buffer.

Do not include the command terminator in the file; once you have finished editing, enter the terminator interactively on a line by itself.

:R filename

Reads an operating system file into the command buffer then shows the command.

Do not include the command terminator in the file; once you have finished editing, enter the terminator interactively on a line by itself.

use database_name

Changes the current database.

!! os_command

Executes an operating system command. Place at the start of a line.

> file_name
Redirects the output of the Transact-SQL command to file_name. This example inserts the server version into file_name:
select @@version
go > file_name
>> file_name
Appends the output of the Transact-SQL command to file_name.This example appends the server version to file_name:
select @@version
go >> file_name
| command
Pipes the output of the Transact-SQL command to an external command. This example finds all instances of “sa” in the listing produced by sp_who:
sp_who
go | grep sa
vi (UNIX) or edit (Windows)

Calls the default editor.

reset

Clears the query buffer.

quit or exit

Exits isql.