{"id":21855,"date":"2018-02-21T10:00:25","date_gmt":"2018-02-21T18:00:25","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/dataplatforminsider\/?p=21855"},"modified":"2024-01-22T22:51:11","modified_gmt":"2024-01-23T06:51:11","slug":"announcing-a-new-update-for-mssql-cli-special-commands","status":"publish","type":"post","link":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2018\/02\/21\/announcing-a-new-update-for-mssql-cli-special-commands\/","title":{"rendered":"Announcing a new update for mssql-cli: Special Commands"},"content":{"rendered":"
We have released our first major update for mssql-cli<\/a> since our recent Public Preview announcement in December. You can view the public preview announcement here<\/a>.<\/p>\n mssql-cli is a new and interactive command line query tool for SQL Server. This open source tool works cross-platform and is part of the dbcli community<\/a>.<\/p>\n In our initial release, mssql-cli brought auto-completion, syntax highlighting, configuration support, and history to your SQL Server command line experience. Bringing more features over from PGCLI<\/a>, we introduce special commands.<\/p>\n Special commands are meant to make your life easier. They are shortcuts to perform common tasks and queries. All special commands start with a backslash (\\), and you can use the built-in IntelliSense to see a list of special commands you can use. You can also learn more by running the following command:<\/p>\n To start off, let\u2019s say you have a common query you run often, but don\u2019t want to type it out each time or scroll through your history. You can \u201csave\u201d your query by running the following special command:<\/p>\n To execute this query, simply run:<\/p>\n To see this in action, see the gif below:<\/p>\n To learn more about special commands, please check out usage guide<\/a>, which also includes information about other features that you can use with mssql-cli.<\/p>\n 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.<\/p>\n mssql-cli is installed via pip. If you know pip, you can install mssql-cli using command.<\/p>\n Once you have mssql-cli installed, connect to your database with the command:<\/p>\n Please try out mssql-cli and submit any feature requests and issues on our Github issues page<\/a>. You can also keep track of any future updates by following our Twitter @sqldatatools<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":" We have released our first major update for mssql-cli since our recent Public Preview announcement in December. You can view the public preview announcement here. mssql-cli is a new and interactive command line query tool for SQL Server. This open source tool works cross-platform and is part of the dbcli community. Feature highlight: Special commands<\/p>\n","protected":false},"author":1457,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ep_exclude_from_search":false,"_classifai_error":"","_classifai_text_to_speech_error":"","footnotes":""},"post_tag":[],"product":[5227,2406,2409,2418],"content-type":[2448],"topic":[2475],"coauthors":[2487],"class_list":["post-21855","post","type-post","status-publish","format-standard","hentry","product-sql","product-sql-server-2017","product-sql-server-2017-on-linux","product-sql-server-on-linux","content-type-updates","topic-oltp-database-management","review-flag-1593580361-1","review-flag-1593580770-633","review-flag-new-1593580247-437","review-flag-publi-1593580761-761"],"yoast_head":"\nFeature highlight: Special commands<\/h2>\n
<\/p>\n
$ mssql-cli>\\?<\/pre>\n
$ mssql-cli>\\sn address select * from \"Person\".\"AddressType\"<\/pre>\n
$ mssql-cli>\\n address<\/pre>\n
<\/p>\n
Getting started<\/h2>\n
$ pip install mssql-cli<\/pre>\n
$ mssql-cli -S <server name> -U <user name> -d <database name><\/pre>\n