By default, the command history feature is off. Activate it by using the --history command line option. --history loads the contents of the command history log file, if it exists, when isql starts.
isql [--history [p]history_length [--history_file history_filename]]
p – indicates command history persistence; in-memory command history is saved to disk when isql shuts down. If you do not use the p option, the command history log is deleted after its contents are loaded into memory.
history_length – this parameter, which is required if you use --history, is the number of commands that isql can store in the command history log. The maximum value of history_length is 1024; if a larger value is specified, isql silently truncates it to 1024.
--history_file history_filename – indicates that isql must retrieve the command history log from history_filename. If p is specified, isql also uses history_filename to store the current session’s command history. history_filename can include an absolute or a relative path to the log file. A relative path is based on the current directory. If you do not indicate a path, the history log is saved in the current directory.
When --history_file is not specified, isql uses the default log file:
For UNIX: $HOME/.sybase/isql/isqlCmdHistory.log
For Windows: %APPDATA%\Sybase\isql\isqlCmdHistory.log
Example 1 Deletes myaseHistory.log after loading its contents to memory. The session’s command history is not stored:
isql -Uguest -Ppassword -Smyase --history 1024 --history_file myaseHistory.log
Example 2 Loads and saves the command history using the default log file:
isql -Uguest -Ppassword -Smyase --history p1024
The command history feature is available only in command mode. Also, 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 go EOF
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.