Command History in isql

The command history feature is available in command mode.

Only commands that are issued interactively in isql are included in the command history. Examples of commands that are not included in the command history are those that are executed using the -i command line option or as part of a redirected input, such as:
isql -Uguest -Ppassword -Smyase --history p1024
    --history_file myaseHistory.log <<EOF
exec sp_x_y_z

Command history contains the most recent commands issued in an isql session. When history_length is reached, isql drops the oldest command from the history and adds the newest command issued.

If you do not specify an alternate log file, and if the $HOME or %APPDATA% environment variable used by the default log file is not defined, an error message appears and the command history log is not saved.

In an isql session, use the h [n] command to display the command history. A page can display up to 24 lines of commands. If the command history contains more than 24 lines, press Enter to display the next set of commands or enter “a” to display all commands in one page. Enter “q” to return to isql.

n indicates the number of commands to appear. If n is:
  • Positive – the commands that appear start from the oldest command in the history.
  • Negative – the n most recent commands appear.

Use the ? n | ?? command to recall and reissue a command from the command history.

When n is positive, isql looks for the command labeled with the number n and loads this to the command buffer. When n is negative, isql loads the nth most recent command issued.

?? – recalls the latest command issued and is equivalent to ? -1.

  • When a command is recalled from history, the recalled command overwrites the command in the command buffer.

  • You can edit a recalled command before resubmitting the command to the server.