Formatting isql output

Table 2-1 describes the options that change the format of isql output:

Table 2-1: Format options for isql

Option

Default

Meaning

-h headers

1

Number of rows to print between column headings

-s colseparator

Single space

Changes the column separator character

-w columnwidth

80 characters

Changes the line width

-e

Includes each command issued to isql in the output

-n

Removes numbering and prompt symbols.

In this example, the query’s results are placed in a file called output:

isql -Uuser_name -Ppassword -Sserver -e -n -o output
use pubs2
go
select *
from authors
where city = "Oakland"
go
 quit

To view the contents of output, enter:

select *
from authors
where city = "Oakland"
au_id         au_lname         au_fname
phone         address
city          state country    postalcode
----------- -------------------------------------------- -----------
--------
---------- ----------------------------------------
------------------ ---- ----------- -----------
213-46-8915 Green                          Marjorie
                 415 986-7020 309 63rd St. #411
                  Oakland   CA   USA    94618
274-80-9391 Straight                       Dick
                 415 834-2919 5420 College Av.
                 Oakland    CA    USA   94609
724-08-9931 Stringer                       Dirk
                 415 843-2991 5420 Telegraph Av.
                 Oakland    CA    USA   94609
724-80-9391 MacFeather                     Stearns
                 415 354-7128 44 Upland Hts.
                 Oakland    CA    USA   94612
756-30-7391 Karsen                         Livia
                 415 534-9219 5720 McAuley St.
                  Oakland     CA     USA   94609

NoteThe output file does not include the command terminator.