1 Version 4.0 -- 1/15/89 isql
______________________________________________________________________
NAME: isql
FUNCTION:
Interactive SQL parser to SQL Server.
SYNTAX:
isql [-e] [-p] [-i] [-n]
[ -c cmdend] [ -h headers] [ -w columnwidth] [ -s colseparator]
[ -t timeout] [ -m errorlevel]
[ -H hostname] [ -U username] [ -P password]
[ -I interface] [-S server]
isql Version 4.0 -- 1/15/89 2
______________________________________________________________________
To terminate a command: go
To clear the query buffer: reset
To call the editor: vi
To execute an operating system command: !! command
To exit from isql: quit or exit
PARAMETERS:
-e - echoes input.
-p - prints out performance statistics.
-i - tags all isql input and output with the process ID number.
It can be used for tracing multi-user tests.
-n - removes numbering and the prompt symbol (>) from input
lines.
3 Version 4.0 -- 1/15/89 isql
______________________________________________________________________
-c cmdend - allows the user to reset the command terminator. By
default, commands are terminated and sent to SQL Server by
entering go on a line by itself. When you reset the command
terminator, do not use SQL reserved words or characters that
have special meaning to the operating system, whether pre-
ceded by a backslash or not.
-h headers - allows the user to specify how many rows to print
between column headings. The default is to print headings
only once for each set of query results.
-w columnwidth - allows the user to set the screen width for
output. The default is 80 characters. When an output line
has reached its maximum screen width, it is broken into mul-
tiple lines.
-s colseparator - allows the user to reset the column separator
character, which is blank by default. To use characters that
have special meaning to the operating system (e.g., |, ;, &,
<, >), enclose them in quotes or precede them with a
isql Version 4.0 -- 1/15/89 4
______________________________________________________________________
backslash, \.
-t timeout - allows the user to specify the number of seconds
before a command times out. If no timeout is specified, a
command runs indefinitely; however, the default timeout for
logging in to isql is 60 seconds.
-m errorlevel - allows the user to customize display of error
messages. For errors of the severity level specified or
higher, no error text is displayed. The message number,
state, and error level are displayed. For errors of levels
lower than the specified level, nothing is displayed.
-H hostname - allows the user to specify a host name, changing
the value in the dynamic system table sysprocesses, if he or
she logs in from a different computer than usual. If no host
name is specified, the current computer name is assumed.
-U username - allows the user to specify a login name. Logins
are case sensitive.
-P password - allows the user to specify a password. If the -P
5 Version 4.0 -- 1/15/89 isql
______________________________________________________________________
flag is not given, isql prompts for a password. If the -P
flag is given at the end of the command line without any
password, isql uses the default password (NULL). Passwords
are case sensitive.
-I interface - allows the user to specify the name and location
of the interfaces file that is (optionally) searched as part
of the process of connecting to SQL Server. The named file
contains the name and network address of every available
SQL Server on the network. If this option is not used, isql
looks for a file named interfaces.
-S server - allows the user to specify the name of the particu-
lar SQL Server with which to connect. This is the name that
SQL Server looks up in the interfaces file.
EXAMPLES:
1) isql -p -s#
isql Version 4.0 -- 1/15/89 6
______________________________________________________________________
2) isql -Ujoe
Password:
1>select *
2>from authors
3>where city = "Oakland"
4>go
Executes the command.
7 Version 4.0 -- 1/15/89 isql
______________________________________________________________________
3) isql -Ujoe -Pabracadabra
1>select *
2>from authors
3>where city = "Oakland"
4>vi
Puts you in a text file where you can edit the query. When
you write and save the file, you are returned to isql. The
query is displayed. Type go to execute it.
isql Version 4.0 -- 1/15/89 8
______________________________________________________________________
4) isql -U alma -P
1>select *
2>from authors
3>where city = "Oakland"
4>reset
1>quit
The reset clears the query buffer. The quit keyword returns
you to the operating system.
COMMENTS:
o The isql program is invoked directly from the operating system.
The isql program accepts SQL commands and sends them to
SQL Server. The results are formatted and printed on standard
output. The isql program exits with quit or exit.
9 Version 4.0 -- 1/15/89 isql
______________________________________________________________________
o Terminate a command by typing a line beginning with the command
terminator. The default command terminator is go. You may
follow the command terminator with an integer to specify how
many times the command should be run. For example, to cause
this command to be executed 100 times, type:
select x = 1
go 100
The results are displayed once, at the end of execution.
o The user may call an editor on the current query buffer by
entering ``vi'' as the first word on a line. The editor is
defined in the EDITOR environment variable. The default is
``vi''.
o Operating system commands may also be executed by starting a
line with two ``!'' followed by the command.
isql Version 4.0 -- 1/15/89 10
______________________________________________________________________
o The existing query buffer can be cleared by typing reset as the
first thing on a line by itself. It will cause any pending
input to be discarded.
o The command terminator (go by default), and commands such as
reset, vi, !!, exit and quit are recognized only if they appear
at the very beginning of a line, immediately following the isql
prompt. Anything entered on that line after these keywords is
disregarded by isql.
o Control-C performs a reset, but can be entered anywhere on a
line. The effect is to cancel the current query, and return
the user to ``1>''.
o To use isql interactively, give the command isql (and any of
the optional flags) at your operating system prompt.
o You can read in a host file containing a query for execution by
isql like this:
11 Version 4.0 -- 1/15/89 isql
______________________________________________________________________
isql -U alma -P < input_file_name
The file must include command terminator(s). The results are
displayed on the user's terminal.
You can read in an operating system file containing a query and
direct the results to another file, like this:
isql -U alma -P < input_file_name > output_file-name
o When using isql interactively, you can read a host file into
the command buffer with :r filename. Do not include a command
terminator in the file; enter the terminator interactively once
you have finished editing.
o You can include comments in a Transact-SQL statement submitted
to SQL Server by isql. Open a comment with ``/*''. Close it
with ``*/''. Comments can be nested.
isql Version 4.0 -- 1/15/89 12
______________________________________________________________________
For example:
select au_lname, au_fname
/*retrieve authors' last and first names*/
from authors, titles, titleauthor
where authors.au_id = titleauthor.au_id
and titles.title_id = titleauthor.title_id
/*this is a three-way join that links authors
**to the books they have written.*/