BSQLDB(1)
π
bsqldb β the batch SQL script processor (a General Commands Manual classic, bestie)
okay so picture this: it's a General Commands Manual page, the utility is called bsqldb, and it is literally a batch SQL script processor that runs on DB-Library. she's iconic, she's efficient, and she's about to make your whole terminal pop off β¨
πΈ NAME πΈ
bsqldb β batch SQL script processor using DB-Library π«Ά
π SYNOPSIS π
bsqldb [-hqv] [-S servername] [-D database] [-U username] [-P password]
[-i input_file] [-o output_file] [-e error_file] [-H hostname]
[-t field_term] [-R pivot_description]
π¦ DESCRIPTION π¦
bsqldb is a utility program distributed with FreeTDS. she's the non-interactive equivalent of the "isql" utility programs distributed by Sybase and Microsoft β like, same energy, but she doesn't need you hovering over her asking questions πββοΈ
just like them, bsqldb uses the command go on a line by itself as a separator between batches. and here's the cute part: the last batch doesn't even need a go after it. she just knows. β¨
bsqldb makes use of the DB-Library API provided by FreeTDS. and this API is, of course, also available to application developers β so if you're out here building stuff, this is your moment, bestie π
β¨ OPTIONS β¨
-Ddatabase β the database to use. pick your girl π-Hhostname β hostname overrides the name of the client that gets sent to the server. lowkey a glow-up for your identity β¨-Ppassword β the database server password π-Sservername β the database server to which to connect π°οΈ-Uusername β the database server login name. and listen: if username is not provided, a domain login is attempted for TDS 7+ connections π-eerror_file β name of the file for errors π-hβ print column headers with the data to the same file π-iinput_file β name of the script file, containing SQL π-ooutput_file β name of the output file, holding result data π¦-qβ do not print column metadata, return status, or rowcount. and heads up: this one overrides-hπ-tfield_term β specifies the field terminator. default is two spaces (' '). the recognized escape sequences are tab ('\t'), carriage return ('\r'), newline ('\n'), and backslash ('\\') π-vβ verbose mode, for more information about the DB-Library interaction. this also reports the result set metadata, including and return code. all verbose data are written to standard error (or-e), so as not to interfere with the data stream π (ngl, very considerate of her)-Rpivot_description β specify pivot trasformation. the format is β¨down columnsβ© β¨across columnsβ© β¨functionβ© β¨valueβ©. columns are specified but numbers. the format of down columns and across columns is a comma separated list of columns. function is eithercount,sum,minormaxπ
π ENVIRONMENT π
DSQUERYβ default servername π·οΈ
π NOTES π
bsqldb is a filter; she reads from standard input, writes to standard output, and writes errors to standard error. the -i, -o, and -e options override these defaults. periodt. π
the source code for bsqldb is intended as a model for DB-Library users. DB-Library has a rich set of functions, and it can be hard sometimes to understand how to use them, particularly the first time β and honestly? relatable. π if you find something about the source code unclear, you are encouraged to email the author your comments. she wants the feedback, bestie π«Ά
β EXIT STATUS β
bsqldb exits 0 on success, and >0 if the server cannot process the query. no cap.
for messages with severity > 10, bsqldb calls exit(3) with the severity level. like, for example, if the severity level is 16, bsqldb will return an exit status of 16 to the shell. yes she's dramatic about it, but she's precise π₯
π°οΈ HISTORY π°οΈ
bsqldb first appeared in FreeTDS 0.63. a legend from day one π
π§ AUTHORS π§
the bsqldb utility was written by James K. Lowden <jklowden@freetds.org>. thank you king ππ
π BUGS π
Microsoft servers as of SQL Server 7.0 SP 3 do not return output parameters unless the RPC functions are used. this means bsqldb cannot return output parameters for stored procedures with these servers. like, she would if she could, but the server said no π
okay that's the whole page and you ate, fr fr π this was FreeTDS 1.5.20, dated March 26, 2015, page BSQLDB(1) β mwah, go run some batches bestie π
β¨
π¦ where this page comes from
- arch rolling: freetds 1.5.20-1 Β· GPL-2.0-only AND LGPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms