·
2 min read

Announcing mssql-cli is now generally available on macOS and Linux

We are excited to announce that mssql-cli is now generally available on macOS and Linux.

mssql-cli is an open source and cross-platform command-line tool (CLI) to manage SQL Server on-prem and on the cloud. We are a proud member of the dbcli family of open source command line tools to manage relational databases.

If you are a user of sqlcmd, you will love the interactive and modern design components in mssql-cli. With this release, you will also be able to use mssql-cli in non-interactive scenarios such as scripting and automation. Read on to learn more about how mssql-cli will help improve your productivity through a modern CLI experience.

Key features

Intellisense and syntax highlighting

One of the major features of mssql-cli is that you get Intellisense as you are writing queries in the command line. This is the first time that our SQL Server command line tools have included this experience, and it will make it much easier to write your ad-hoc queries and even discover your database objects.

intellisense in mssql-cli

Horizontal paging

In the past, users did not have many options when displaying results that go off the screen due to the size of the result. With mssql-cli, we support horizontal paging so that users can easily navigate with arrow keys to read through the results of a query.

horizontal paging to see long table

Special commands

Users can easily run common queries and actions using a default set of special commands. It is also highly customizable, so if you find yourself running the same queries each time, you can save it and easily run it.

Multi-line mode

When writing complex queries, users in the past would not have many options to format the query appropriately so that you can ensure your query is accurate. With multi-line mode, we make it very easy for you to construct and navigate your query.

format queries in multi-line mode

New features

For the first time, mssql-cli now supports non-interactive mode scenarios. From sqlcmd, we now support the following parameters:

  • -Q: Run a query in the command line
  • -i: Execute a provided T-SQL input file
  • -o: Save the result in an output file

scripting support in mssql-cli

If there are additional parameters you need supported in mssql-cli, please submit a feature request to our GitHub Issues.

Try it now

You can install mssql-cli by using our installation guide. mssql-cli is available on Windows (preview), macOS, and Linux, and the guide will help you install mssql-cli on any operating system.

In order to install mssql-cli, you must have Python on your machine. Please refer to the installation guide for OS-specific methods to get Python.

Once you have mssql-cli installed, connect to your database with the command:

$ mssql-cli -S <server name> -U <user name> -d <database name>

Once you are set up, follow our usage guide to get started with using mssql-cli.

Contact us

We are open to any questions, feedback, or feature suggestions for future releases, which can be submitted on our GitHub Issues.