I'm using FreeTDS in a script to insert records into a MSSQL database. TheUSE
andINSERT
commands work, but theexit
command doesn't and it hangs. I've tried redirectingstdout
butcat
complains. I suppose I will use Expect otherwise. Meh. Thanks.
echo -e "USE db\nGO\nINSERT INTO db_table (id, data, meta)\nVALUES (1, 'data', 'meta')\nGO\nexit" > tempfile
cat tempfile - | tsql -H 10.10.10.10 -p 1433 -U user -P pass