6

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.

  • 2
    Considering you say you're storing utf-8 data in SQL Server, I *assume* you're using SQL Server 2019 preview? – Thom A Feb 11 '19 at 11:50
  • Unicode means UTF16 on Windows and SQL Server. Unicode text is stored in `nvarchar` fields. It works without any issue - SO is an ASP.NET web site that uses SQL Server. UTF8 support was added only for bulk import/export in the latest versions. UTF8 as a varchar encoding *will* be added in SQL Server 2019, which is currently in preview – Panagiotis Kanavos Feb 12 '19 at 12:14
  • 1
    Have you tried [mssql-cli](https://learn.microsoft.com/en-us/sql/tools/mssql-cli?view=sql-server-2017) or [Azure Data Studio](https://learn.microsoft.com/en-us/sql/azure-data-studio/what-is?view=sql-server-2017)? Unfortunate name, but that's the cross-platform developer IDE for SQL Server – Panagiotis Kanavos Feb 12 '19 at 12:19

4 Answers4

0

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

Dan Guzman
  • 43,250
  • 3
  • 46
  • 71
JERRY
  • 1,165
  • 1
  • 8
  • 22
0

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
Lukasz Szozda
  • 162,964
  • 23
  • 234
  • 275
0

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.

Aladdin
  • 1,207
  • 2
  • 16
  • 26
0

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

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

caseyboardman
  • 799
  • 2
  • 11
  • 26