Unicode in sqsh connecting to MSSQL (or alternatives)

2k Views Asked by At

I have a MSSQL database, which contains Unicode (utf8) data. My workstation is linux (currently Ubuntu) and looking for a tool to work with mssql database I found SQSH. The problem is - when I select data in the sqsh console I get jibberish instead of unicode characters. Using switch "-J utf8" or "-J utf-8" didn't change anything.

The question is - how to set up sqsh to work with utf-8 data?

If it is not possible, do you know any alternative tools usable from linux for work with mssql databases filled with utf-8 data. I need to execute all kinds of T-SQL, run previsously prepared SQL script files, and pipe out results for processing afterwards. A good GUI (open source) could also be used, not limited to shell clients.

4

There are 4 best solutions below

0
On

I had the same problem and it seems it has nothing to do with charchters encoding, but the problem was there are control character, unprintable characters, in the script.

I removed them from the sql script and everything works fine.

0
On

Use Azure Data Studio to avoid data troubleshooting issue. it is a great SSMS alternative for Linux.

0
On

If you need command line tool I suggest to use official sqlcmd from mssql-tools. It is available for all major Linux distributions including Ubuntu.

Connecting with sqlcmd


Another shell tool is mssql-cli

Features

Mssql-cli is a new and interactive command line tool that provides the following key enhancements over sqlcmd in the Terminal environment:

  • T-SQL IntelliSense
  • Syntax highlighting
  • Pretty formatting for query results, including Vertical Format
  • Multi-line edit mode
  • Configuration file support
0
On

Are you using freetds with sqsh? If you are, edit your freetds.conf to set the charset.

http://www.freetds.org/userguide/localization.htm