1. BackgroundAfter installing SQL Server on Linux, using sqlcmd at the command line, you will find code hints, syntax highlighting, and even multi-line replication not supported, compared to MySQL's command-line client is much more useful. Only simple command management is OK, do database development must also use SSMS. However, Microsoft recently released an interactive tool for the new command line for SQL Server-Mssql-cli,See the SQL Server Blog for more information:https://blogs.technet.microsoft.com/dataplatforminsider/2017/12/12/ try-mssql-cli-a-new-interactive-command-line-tool-for-sql-server/The tool provides the following features:
- T-SQL IntelliSense Smart T-SQL IntelliSense
- Syntax highlighting syntax highlighting
- Pretty formatting for query results, including Vertical format query result formatting, including vertical format
- Multi-line edit mode multi-line editing modes
- Configuration file Support Profile
Figure-1: Smart Tip Figure-2: Formatted display
2. InstallationLet's try the tool below. Here are just a few demos of CentOS7, other platforms can refer to SQL Server Blog, or more detailed installation instructions on GitHub:https://github.com/dbcli/mssql-cli/blob/master/doc/installation_guide.md2.1 Installing the latest EPEL(Extra Packages for Enterprise Linux) [email protected] ~]# Yum install Epel-release2.2 Installation related dependencies[email protected] ~]# Yum install libunwind Libicu python-pip2.3 Installing MSSQL-CLI[[Email protected] ~]# pip install MSSQL-CLI2.4 Sign in with MSSQL-CLI[Email protected] ~]# mssql-cli-u sapassword:version:0.8.0mail: [Email protected]home:http://github.com/dbcli/ Mssql-climaster>select @ @version+--------------------+| (No column name) | | --------------------|| Microsoft SQL Server (RC2)-14.0.900.75 (X64) 08:53:49copyright (C) Microsoft Corporationdeveloper E Dition (64-bit) on Linux (CentOS Linux 7 (Core)) |+--------------------+ (1 row affected) time:0.103smaster>3. ExperienceIn Xshell use MSSQL-CLI, have the following points of experience, welcome to add.
- Syntax highlighting, smart hints, query results, the format of the beautification have.
- If the field is displayed too long, the field of the table is automatically displayed in portrait format and supports row-by-line scrolling.
- The direct carriage return executes the statement without having to go to the end.
However, several problems have been found:
- It is still an error to paste multiple lines of statements directly. (Did I copy the wrong pose?)
- The query returns more data, the results are slow, and the query for large data is slow. If you can't wait to press CTRL + C two times, the following error will occur.
- The contents of the field are too long to be displayed intact.
Figure-3: The query process two times CTRL + C after the error Figure-3: The contents of the field display is incomplete4. SummaryEnhanced functionality in the command-line environment is good for use in scenarios where there is no graphical interface. If you are using it for development, management, or querying, or if you have conditions, it is recommended that you use SSMS under the Windows platform. In addition, please add:http://www.codeplex.com/is no longer updated, to download the sample database for SQL Server directly to GitHub (https://github.com/Microsoft/sql-server-samples/releases/tag/ AdventureWorks) Download is more convenient.
Experience MSSQL-CLI