Sqsh; a superior choice to isql

Sqsh is a tool written by Scott Gray, a Sybase professional services consultant based in Philadelphia (and coincidentally a former project team member at a previous client). He has written an open-server based tool that far exceeds the capabilities of the Sybase tool isql for performing interactive SQL tasks. Sqsh stands for SQ-shell and can be found at its home page (this will open in a new browser window).

The extensive man page can be found in sqsh.1, which comes with the sqsh distribution. To view this man page you'll need to execute this command:

% nroff -man sqsh.1 | more

The advantages of sqsh include:


Here's an example .sqshrc file; edit this file in your home directory and chmod 400 it if you're keeping cleartext passwords in it.

\set banner=no
\set username="sa"
\set password="[password]"
\set hostname="Boss_sqsh"
\set history_shorthand=on
\set statistics=off
\set semicolon_hack=off
\set database=db_name
\set prompt="SERVER >"
\alias clear="\shell clear"
\alias r="\buf-load "
\alias :r="\buf-load "
\alias sh="\shell "                  
\set style="bcp"
\alias gob="\go -m bcp"
\alias goh="\go -m hor"

the options are as follows:
- \set banner=no: turns off the sqsh banner; cosmetic only
- \set username="sa": emulates isql -Usa
- \set password="[password]": emulates isql -P[password]
- \set hostname="Boss_sqsh": emulates isql -H[hostname]
- \set history_shorthand=on: turns on ability to have !-recall commands
- \set statistics=off: if on, you get "set statisticsio on" stats after every command
- \set semicolon_hack=off; if on, you can have a ";" execute commands just like in oracle, in addition to having "go" execute commands. You can also have inline semicolons executing commands...but its a performance drag
- \set database=db_name; automatically issues an "use db_name" call as you log in, overriding whatever default database you may have configured for your login name - \set prompt="SERVER >": resets the isql prompt to be as specified, not the line number of the isql prompt. useful when you're logging into multiple server environments, but it is not dynamically configurable, and you lose the line number (which some people have grown to depend on). - \alias clear="\shell clear": alias to clear screen within sqsh session (provides same functionality as clear does in isql)
- \alias :r="\buf-load ": provides isql functionality to read a file into sqsh session
- \alias r="\buf-load " : same as above
- \alias sh="\shell ": drops you into a shell out of sqsh
- \alias gob="\go -m bcp ": this prints output of a select statement in bcp format. VERY useful for doing quick bcp commands, and using re-direction to a file. - \alias goh="\go -m hor ": this is the default way of returning data; alias included incase you have set default style of returning to be bcp. (set w/ command below) - \set style="bcp": defaults select statement data returned to be in bcp format.