Interactive SQL parser to Adaptive Server.
The utility is located in:
(UNIX) $SYBASE/$SYBASE_OCS/bin.
(Windows) the utility is isql.exe, located in %SYBASE%\%SYBASE_OCS%\bin.
isql [-b] [-e] [-F] [-p] [-n] [-v] [-W] [-X] [-Y] [-Q] [-a display_charset] [-A packet_size] [-c cmdend] [-D database] [-E editor] [-h header] [-H hostname] [-i inputfile] [-I interfaces_file] [-J client_charset] [-K keytab_file] [-l login_timeout] [-m errorlevel] [-o outputfile] [-P password] [-R remote_server_principal] [-s colseparator] [-S server_name] [-t timeout] -U username [-V [security_options]] [-w columnwidth] [-z locale_name] [-Z security_mechanism] [--conceal]
See “Commands available within interactive isql” for a list and description of commands that can be executed from within isql.
disables the display of the table headers output.
echoes input.
enables the FIPS flagger. When you specify the -F parameter, the server returns a message when it encounters a non-standard SQL command. This option does not disable SQL extensions. Processing completes when you issue the non-ANSI SQL command.
prints performance statistics.
removes numbering and the prompt symbol (>) from the echoed input lines in the output file when used in conjunction with -e.
prints the version number and copyright message for isql and then exits.
initiates the login connection to the server with client-side password encryption. -X enables both extended password encrypted connections and password encrypted connections without plain text password reconnection. isql (the client) specifies to the server that password encryption is desired. The server sends back an encryption key, which isql uses to encrypt your password, and the server uses the key to authenticate your password when it arrives.
If isql crashes, the system creates a core file that contains your password. If you did not use the encryption option, the password appears in plain text in the file. If you used the encryption option, your password is not readable.
disables both extended password and password encrypted negotiations
tells the Adaptive Server to use chained transactions.
provides clients with failover property. See Using Sybase Failover in a High Availability System for more information.
runs isql from a terminal whose character set differs from that of the machine on which isql is running. Use -a in conjunction with -J to specify the character set translation file (.xlt file) required for the conversion. Use -a without -J only if the client character set is the same as the default character set.
The ascii_7 character set is compatible with all character sets. If either the Adaptive Server character set or the client character set is set to ascii_7, any 7-bit ASCII character can pass unaltered between client and server. Other characters produce conversion errors. For more information on character set conversion, see the System Administration Guide.
specifies the network packet size to use for this isql session.
changes the command terminator. By default, you terminate commands and send them to by typing “go” on a line by itself. When you change the command terminator, do not use SQL reserved words or control characters.
selects the database in which the isql session begins.
specifies an editor other than the default editor vi. To invoke the editor, enter its name as the first word of a line in isql.
specifies the number of rows to print between column headings. The default prints headings only once for each set of query results.
sets the client host name.
specifies the name of the operating system file to use for input to isql. The file must contain command terminators (“go” is the default).
Specifying the parameter is equivalent to < inputfile:
-i inputfile
If you use -i and do not specify your password on the command line, isql prompts you for it.
If you use < inputfile and do not specify your password on the command line, specify your password as the first line of the input file.
specifies the name and location of the interfaces file to search when connecting to Adaptive Server. If you do not specify -I, isql looks for a file named interfaces in the directory specified by your SYBASE environment variable.
specifies the character set to use on the client. -J client_charset requests that Adaptive Server convert to and from client_charset, the character set used on the client. A filter converts input between client_charset and the Adaptive Server character set.
-J with no argument sets character set conversion to NULL. No conversion takes place. Use this if the client and server use the same character set.
Omitting -J sets the character set to a default for the platform. The default may not necessarily be the character set that the client is using. For more information about character sets and the associated flags, see “Configuring Client/Server Character Set Conversions,” in the System Administration Guide, Volume One.
specifies the path to the keytab file used for authentication in DCE.
specifies the maximum timeout value allowed when connecting to Adaptive Server. The default is 60 seconds. This value affects only the time that isql waits for the server to respond to a login attempt. To specify a timeout period for command processing, use the -t timeout parameter.
customizes the error message display. For errors of the severity level specified or higher, only the message number, state, and error level are displayed; no error text appears. For error levels lower than the specified level, nothing appears.
specifies the name of an operating system file to store the output from isql. Specifying the parameter as -o outputfile is similar to > outputfile
specifies your Adaptive Server password. If you do not specify the -P flag, isql prompts for a password. If your password is NULL, use the -P flag without any password.
specifies the principal name for the server as defined to the security mechanism. By default, a server’s principal name matches the server’s network name (which is specified with the -S parameter or the DSQUERY environment variable). Use the -R parameter when the server’s principal name and network name are not the same.
resets the column separator character, which is blank by default. To use characters that have special meaning to the operating system (for example, “|”, “;”, “&”, “<”, “>”), enclose them in quotes or precede them with a backslash.
The column separator appears at the beginning and the end of each column of each row.
specifies the name of the Adaptive Server to which to connect. isql looks this name up in the interfaces file. If you specify -S with no argument, isql looks for a server named SYBASE. If you do not specify -S, isql looks for the server specified by your DSQUERY environment variable.
specifies the number of seconds before a SQL command times out. If you do not specify a timeout, the command runs indefinitely. This affects commands issued from within isql, not the connection time. The default timeout for logging into isql is 60 seconds.
specifies a login name. Login names are case sensitive.
specifies network-based user authentication. With this option, the user must log in to the network’s security system before running the utility. In this case, users must supply their network user name with the -U option; any password supplied with the -P option is ignored.
Follow -V with a security_options string of key-letter options to enable additional security services. These key letters are:
c – Enable data confidentiality service
i – Enable data integrity service
m – Enable mutual authentication for connection establishment
o – Enable data origin stamping service
q – Enable out-of-sequence detection
r – Enable data replay detection
sets the screen width for output. The default is 80 characters. When an output line reaches its maximum screen width, it breaks into multiple lines.
specifies the official name of an alternate language to display isql prompts and messages. Without -z, isql uses the server’s default language. Add languages to an Adaptive Server during installation or afterward, using the langinstall utility (langinst in Windows) or the sp_addlanguage stored procedure.
specifies the name of a security mechanism to use on the connection.
Security mechanism names are defined in the libtcl.cfg configuration file located in the ini subdirectory below the Sybase installation directory. If no security_mechanism name is supplied, the default mechanism is used. For more information on security mechanism names, see the description of the libtcl.cfg file in the Open Client and Open Server Configuration Guide.
Hides your input during an isql session. The --conceal option is useful when entering sensitive information, such as passwords. The syntax for the --conceal option is:
isql --conceal [':?' | 'wildcard']
The maximum length of wildcard, a 32-byte variable, is 80 characters.
--conceal is silently ignored in batch mode.
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 appears; type “go” on a line by itself to execute it:
isql -Ujoe -Pabracadabra 1> select * 2> from authors 3> where city = "Oakland" 4> vi
The reset command clears the query buffer, and quit returns you to the operating system:
isql -Ualma Password: 1> select * 2> from authors 3> where city = "Oakland" 4> reset 1> quit
Specifies that you are running isql from a Macintosh against a server that is using the roman8 character set:
isql -a mac -J roman8
Creates column separators using the “#” character in the output in the pubs2 database for store ID 7896:
isql -Usa -P -s# 1> use pubs2 2> go 1> select * from sales where stor_id = "7896"
#stor_id#ord_num #date # #-------#--------------------#--------------------------# #7896 #124152 # Aug 14 1986 12:00AM# #7896 #234518 # Feb 14 1991 12:00AM# (2 rows affected)
Changes password without displaying the password entered. This example uses “old” and “new” as prompt labels:
$ isql -Uguest -Pguest -Smyase --conceal sp_password :? old , :?:? new ---------------- old new Confirm new Password correctly set. (Return status 0)
Activates a role for the current user. This example uses a custom wildcard and the prompt labels “role” and “password:”
$ isql -UmyAccount --conceal '*'Password: set role * role with passwd ** password on go role password Confirm password
Use this syntax for isql_r if you are using threaded drivers.
Use this syntax for isql if you are using threaded drivers in the IBM platform.
Set the SYBASE environment variable to the location of the current version of Adaptive Server before use isql.
The 5701 (“changed database”) server message is no longer displayed after login or issuing a use database command.
Error message format differs from earlier versions of isql. If you have scripts that perform routines based on the values of these messages you may need to rewrite them.
When you include the -X parameter, the password-enabled connection proceeds according to server capabilities:
If the server can handle both extended password and password encryption, extended password encryption negotiations are used.
If the server can handle password encryption only, password encryption negotiations are used.
If the server cannot handle password encryption or extended password encryption, the first connection attempt fails and the client attempts to reconnect using a plain text password.
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 Adaptive Server. The results are formatted and printed on standard output. Exit isql with quit or exit.
Terminate a command by typing a line beginning with the default command terminator go or another command terminator, if the -c parameter is used. Follow the command terminator with an integer to specify how many times to run the command. For example, to execute this command 100 times, type:
select x = 1 go 100
The results display once at the end of execution.
If you enter an option more than once on the command line, isql uses the last value. For example, if you enter this command, “send”, the second value for -c, overrides “.”, the first value:
isql -c"." -csend
This enables you to override any aliases you set up.
To call an editor on the current query buffer, enter its name as the first word on a line. Define your preferred callable editor by specifying it with the EDITOR environment variable. If EDITOR is not defined, the default is vi on UNIX and edit on Windows.
For example, if your EDITOR environment variable is set to “emacs,” then invoke it from within isql with “emacs” as the first word on the line.
To clear the existing query buffer, type reset on a line by itself. isql discards any pending input. Press Ctrl-c anywhere on a line to cancel the current query and return to the isql prompt.
Read in an operating system file containing a query for execution by isql:
isql -U alma -Ppassword < input_file
The file must include a command terminator. The results appear on your terminal. Read in an operating system file containing a query and direct the results to another file:
isql -U alma -Ppassword < input_file > output_file
Case is significant for the isql flags.
isql displays only six digits of float or real data after the decimal point, rounding off the remainder.
You can include comments in a Transact-SQL statement submitted to Adaptive Server by isql. Open a comment with “/*”. Close it with “*/”, as shown in this 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.*/
If you want to comment out a go command, it should not be at the beginning of a line. For example, use this to comment out the go command:
/* **go */
Do not use this:
/* go */
isql defines the order of the date format as month, date, and year (mm dd yyyy hh:mmAM (or PM)) regardless of the locale environment. To change this default order, use the convert function.
In an isql session, the default prompt label is either the default wildcard :? or the value of wildcard. Customize the prompt label by providing a one-word character string, with a maximum length of 80 characters after a wildcard. If you specify a prompt label that is more than one word, the characters after the first word are ignored.
In an isql session, isql recognizes :?, or the value of wildcard, as wildcards only when these characters are placed at the beginning of an isql line.
Setting the correct network packet size can greatly increase the performance of Adaptive Server.
The -A size option specifies the network packet size to use for an isql session. The default value is 2048 bytes.
This sets the packet size to 4096 bytes for this isql session:
isql -A 4096
To check your network packet size, enter:
select * from sysprocesses
The value is displayed under the network_pktsz heading in the sysprocesses table.
size must be between the values of the default network packet size and maximum network packet size configuration parameters, and must be a multiple of 512.
Use larger-than-default packet sizes to perform I/O-intensive operations, such as readtext or writetext operations.
Setting or changing Adaptive Server packet size does not affect the packet size of remote procedure calls.
The commands you execute from within interactive isql are:
: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 and then displays it.
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 T-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 T-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 T-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)
edit (Windows)
Calls the default editor.
reset
Clears the query buffer.
quit or exit
Exits isql.
Datatype exact numeric datatypes
Documentation Chapter 6, “Using Interactive isql from the Command Line” for details on isql, and the Reference Manual for more information regarding default network packet size and maximum network packet size configuration parameters.
System procedures sp_addlanguage, sp_addlogin, sp_addremotelogin, sp_add_resource_limit, sp_bindexeclass, sp_configure, sp_defaultlanguage, sp_droplanguage, sp_helplanguage, sp_processmail, sp_remoteoption, sp_serveroption, sp_showcontrolinfo, sp_unbindexeclass, sp_volchanged