1BSQLDB(1) BSD General Commands Manual BSQLDB(1)
2
4 bsqldb — batch SQL script processor using DB-Library
5
7 bsqldb [-hqv] [-S servername] [-D database] [-U username] [-P password]
8 [-i input_file] [-o output_file] [-e error_file] [-H hostname]
9 [-t field_term] [-R pivot_description]
10
12 bsqldb is a utility program distributed with FreeTDS. bsqldb is a non-
13 interactive equivalent of the "isql" utility programs distributed by
14 Sybase and Microsoft. Like them, bsqldb uses the command "go" on a line
15 by itself as a separator between batches. The last batch need not be fol‐
16 lowed by "go". bsqldb makes use of the DB-Library API provided by
17 FreeTDS. This API is of course also available to application developers.
18
19
21 -D database
22 Database to use.
23
24 -H hostname
25 hostname Override name of client sent to server.
26
27 -P password
28 Database server password.
29
30 -S servername
31 Database server to which to connect.
32
33 -U username
34 Database server login name. If username is not provided, a domain
35 login is attempted for TDS 7+ connections.
36
37 -e error_file
38 Name of file for errors.
39
40 -h Print column headers with the data to the same file.
41
42 -i input_file
43 Name of script file, containing SQL.
44
45 -o output_file
46 Name of output file, holding result data.
47
48 -q Do not print column metadata, return status, or rowcount. Over‐
49 rides -h.
50
51 -t field_term
52 Specifies the field terminator. Default is two spaces (' ').
53 Recognized escape sequences are tab ('\t'), carriage return
54 ('\r'), newline ('\n'), and backslash ('\\').
55
56 -v Verbose mode, for more information about the DB-Library interac‐
57 tion. This also reports the result set metadata, including and
58 return code. All verbose data are written to standard error (or
59 -e), so as not to interfere with the data stream.
60
61 -R pivot_description
62 Specify pivot trasformation. The format is ⟨down columns⟩
63 ⟨across columns⟩ ⟨function⟩ ⟨value⟩. Columns are specified but
64 numbers. The format of down columns and across columns is a
65 comma separated list of columns. function is either count, sum,
66 min or max.
67
69 DSQUERY default servername
70
72 bsqldb is a filter; it reads from standard input, writes to standard out‐
73 put, and writes errors to standard error. The -i, -o, and -e options
74 override these defaults.
75
76 The source code for bsqldb is intended as a model for DB-Library users.
77 DB-Library has a rich set of functions, and it can be hard sometimes to
78 understand how to use them, particularly the first time. If you find
79 something about the source code unclear, you are encouraged to email the
80 author your comments.
81
83 bsqldb exits 0 on success, and >0 if the server cannot process the query.
84
85 For messages with severity > 10, bsqldb calls exit(3) with the severity
86 level. For example, if the severity level is 16, bsqldb will return an
87 exit status of 16 to the shell.
88
90 bsqldb first appeared in FreeTDS 0.63.
91
93 The bsqldb utility was written by James K. Lowden <jklowden@freetds.org>.
94
96 Microsoft servers as of SQL Server 7.0 SP 3 do not return output parame‐
97 ters unless the RPC functions are used. This means bsqldb cannot return
98 output parameters for stored procedures with these servers.
99
100
101FreeTDS 1.00.38 March 26, 2015 FreeTDS 1.00.38