I am using SQSH (version 2.1) for Ubuntu 10.04 to connect to the MSSQL database using the following command:
sqsh -S server -U user -P password -D database
I have a table called My Table, but I cannot find a way to run a SELECT query on it. This is what I have tried so far:
SELECT * FROM 'My Table' go
Exit: incorrect syntax next to "My table". (I get the same for double quotes)
\set t="My Table" SELECT * FROM $t go
Output: Invalid object name 'My'. (Which is strange, because if I do \ echo $ t, I get the full name of the table)
SELECT * FROM My\\ Table go
Output: The name of the invalid object 'My'.
SELECT * FROM [My Table] go
Output: Unicode data in Unicode or ntext mapping data cannot be sent to clients using a DB library (e.g. ISQL) or ODBC version 3.7 or earlier.
This last command works great for table names without spaces.
UPDATE: other commands work fine, for example. I can get a description of the table with:
SELECT column_name,data_type FROM information_schema.columns WHERE table_name = 'My Table' go
jackocnr
source share