Scriptable command line access to SQL-Server from linux
I found tsql and while its main purpose may lie elsewhere it covers my needs.
It is included in the EPEL package. I installed it with this:
rpm -Uvh http://ftp.df.lth.se/pub/fedora-epel/6/x86_64/epel-release-6-7.noarch.rpm
FreeTDS(May 14, 2011) FreeTDS(May 14, 2011) NAME tsql - utility to test FreeTDS connections and queries SYNOPSIS tsql { -S servername [-I interface] | -H hostname -p port } -U username [-P password] [-o options] tsql -C DESCRIPTION tsql is a diagnostic tool provided as part of FreeTDS. It uses the TDS protocol directly to con- nect to Sybase or Microsoft SQL Servers, and allows the user to issue queries that test the capa- bilities of FreeTDS. tsql is *not* a replacement for a complete isql, such as sqsh (www.sqsh.org). It is designed to rely on the lowest level FreeTDS library, tdslib, as a way to isolate potential bugs in the proto- col implementation.
You might want to look at SQL Workbench/J
It's Java/JDBC based thus runs fine on Linux
It supports a GUI mode, interactive commandline usage (no GUI) and can be run in batch mode. It also supports exporting into various formats in order to take the "dump".
You can use sql-cli to connect to both on-premise and sql azure instance. It allows you to run one-off queries or run script files using .run
command
Usage: mssql [options]
Options:
-h, --help output usage information
-V, --version output the version number
-s, --server <server> Server to conect to
-u, --user <user> User name to use for authentication
-p, --pass <pass> Password to use for authentication
-o, --port <port> Port to connect to
-t, --timeout <timeout> Connection timeout in ms
-d, --database <database> Database to connect to
-q, --query <query> The query to execute
-v, --tdsVersion <tdsVersion> Version of tds protocol to use [7_4, 7_2, 7_3_A, 7_3_B, 7_4]
-e, --encrypt Enable encryption
-f, --format <format> The format of output [table, csv, xml, json]