newbie question here: I have FreeTDS working and querying a Microsoft SQL server 2008 r2 db, from a mint linux vm, reading the inter-webs, mostly stackoverflow, it is mentioned that I should use sqsh also with FreeTDS, SQSH & FreeTDS, I don't understand what sqsh, besides being sometype of cli I guess, adds as I can use FreeTDS to access the db.. Any info to clear this up would be appreciated.
I have used sqsh a lot in the past. It was really helpful.
If you have used sybase/mSServer isql, you'll know that it's a real pain. There's no real support for cmd-line editing and history. SQSH was originally created to provide a shell-like cmd-line environment for interfacing with your database. It very easy to use to extract data from a database and save to a file. You can then edit the file as needed, and use bcp or other to load data into new table.
The SQSH shell supports Environment variables, file redirection (I don't recall using input direction internallY, but being able to write
select c1, c2, c3,c7, c120 from customer > customerFile
was very handy.
See the complete list of features at http://www.sqsh.org under the features link from the menu on the left.
Commands
Variables
Redirection and Pipes
Aliasing
Command Substitution
Backgrounding & Job Control
SQL Batch History
Configurable Exit Status
Inter-Server BCP
Remote Procedure Calls
Semicolon "go"
Simple Scripting
Flow-of-Control
Functions
Multiple Display Styles
X Windows Support
Macro Pre-Processing
Miscellaneous
Commands
Note that Flow-of-control allows to have 1 query that returns a multi-line result set, and use do
, and while
loop processing on each record. This also support if ... elif ..fi
blocks. I don't recall using those features that much, but I found the aliases and env vars, and redirection saved me hours.
That said, I was a motivated user. The documentation will not spoon feed to you all of the answers, so some time will be required for experimentation, head-scratching and review.
I don't have any experience with TDS except to have read about it. Basically the question you need to answer is, am I shell command-line junky, and would I be willing to spend a little time to learn how to get cmd-line power in a text-based SQL client.
IHTH.