I need to query a MS SQL Server database from a linux terminal. Searching the web and this site I found freetds and then sqsh. I have installed them and seems to connect to the server but I can't get it to execute a query, I'm definitely doing something wrong.
I have configure freetds as:
[MSSql]
host = 192.168.1.4
port = 1433
tds version = 7.0
The databse server is a Sql Server 2008 r2.
When connecting I use the following command:
sqsh -S MSSql -U sa -P sa -D databasename
Which gives me a prompt like:
sqsh-2.1.7 Copyright (C) 1995-2001 Scott C. Gray
Portions Copyright (C) 2004-2010 Michael Peppler
This is free software with ABSOLUTELY NO WARRANTY
For more information type '\warranty'
1>
Then I try to enter a query like:
1> select * from C_PROPS;
But nothing happens. What am I doing wrong?, just need simple selects and updates.
I think that the
semicolon_hack
variable is not set.You need to write your command like this
or, at the beginning of a sqsh session
now you can do
or, alternatively, create a .sqshrc in your home directory and insert this snippet