Command-line options

The following table describes the nzsql command-line options.

Table 1. Command-line options for nzsql
Option Description
-a Echoes all input from script
-A Unaligned table output mode (-P format=unaligned)
-c query Runs only single query (or slash command) and exits
-d dbname Specifies the database name to connect to
-D dbname Specifies the database name to connect to
-schema schemaname Specifies the schema name to connect to within dbname.
-e Echoes queries that are sent to the backend
-E Displays queries that internal commands generate
-f filename Runs queries from file, then exits
-F string Sets the field separator (default: "|") (-P fieldsep=)
-h or -host host Specifies the database server host (default: domain socket)
-H HTML table output mode (-P format=html)
-l Lists the available databases, then exits
-n Disables readline
-o filename Sends the query output to a file name (or pipe)
-O filename Sends the query output with errors to a file name (or pipe)
-port port Specifies the database server port (default: hardwired).
-P var[=arg] Sets the printing option 'var' to 'arg'
-q Runs quietly (no messages, only query output)
-r Suppresses the row count in query output.
-R string Sets the record separator (default: newline) (-P recordsep=)
-Rev Shows version information and exits
-rev Shows version information and exits
-s Single-step mode (confirm each query)
-S Single-line mode (newline terminates query)
-t Prints rows only (-P tuples_only)
-time Print the elapsed time for the query to complete
-T text Sets the HTML table tag options (width, border) (-P tableattr=)
-u username Specifies the database user name
-U username Specifies the database user name
-v name=val Sets the nzsql variable 'name' to 'value'
-V Shows the version information and exits
-w Omits the requirement for a database user password because other methods, such as Kerberos, will supply the password.
-W password Specifies the database user password.
-pw password Specifies the database user password.
-x Enables expanded table output (-P expanded).
-X Does not read the startup file (~/.nzsqlrc).
-h or -? Displays this help.