(A lot of this was adopted from here)
Personally, I choose to work on OSX which offers me a nice blend of a unixy like environment but with the convenience of a user friendly os.
Professionally, I choose to work on Linux (if OSX isn’t an option)
Unfortunately, one of the databases used is often MSSQL
I have no good reason (that is still valid in current day and age) but I don’t like graphical interfaces to dbs. SQuirreL is a great tool and all but I just like to putter around on the command line most times.
For the longest time, I use to hack up a python script that would help me interact with mysql from linux.
Obviously that is not the ideal solution and requires a lot of upkeep and hackery on my end.
But laziness is a virtue and I kept looking for better (cough lazier cough) ways.
I don’t know why it took me so long to find this but I just discovered sqsh.
Oh the joys, finally I have a quick and simple way to interact with mssql from the command line.
But man mssql is an awkward db and I really want to have things like tab completion to help me out.
Here’s my setup (not including freetds setup)
Note: The obvious failure here is that you need to add a \set password=blah to your .sqshrc pass to sqsh as an option if you want to crontab this.
I haven’t figured out how to store an encrypted password file for sqsh yet.
This doesn’t include other
My $HOME/bin/populate_sqsh_keywords.sh (don’t forget to chmod +x this)
sqsh -Syourdbhere -i ~/.sqsh_keywords_sql -h -m bcp -o ~/.sqsh_words sed -i.bak 's/|//' ~/.sqsh_words
0 5 * * 1 $HOME/bin/populate_sqsh_keywords.sh