Skip to content

Instantly share code, notes, and snippets.

@Shade30
Created November 20, 2014 06:01
Show Gist options
  • Save Shade30/dd9ddb58e654360ef154 to your computer and use it in GitHub Desktop.
Save Shade30/dd9ddb58e654360ef154 to your computer and use it in GitHub Desktop.
Wrapper to run SQL queries using MS SQL osql.exe utility from Cygwin
#!/bin/bash
# transform arguments for osql
args=
for arg in "$@"
do
if [[ $arg == -* ]] ;
then
args="$args "
fi
if [[ $arg == /tmp* ]] ;
then
arg=$(cygpath -p -w $arg)
fi
args="$args$arg"
done
#echo $args
/cygdrive/d/Program\ Files/Microsoft\ SQL\ Server/110/Tools/Binn/osql $args | iconv -f CP866 -t UTF-8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment