A screen in front of SQL Server, not a prompt

mssql-cmd » Use cases » Interactive SQL

Download mssql-cmd Free Trial »     Buy mssql-cmd Now »

The situation

Command-line clients are precise and unforgiving. A forgotten quote, a missing semicolon, a flag in the wrong order - each is a new attempt, and each attempt is typed again from memory. When you are exploring an unfamiliar schema, the flag you need is the one you cannot remember.

What is missing is not the power of the command line but the feedback: seeing the objects, seeing the SQL, seeing the result.

What you do

  1. Start mssql-cmd - the text interface opens in the terminal.
  2. connect user:password@host:1433/database.
  3. Browse the objects: tables, views and procedures in a searchable list, so you find the name instead of guessing it.
  4. Write SQL in the built-in editor. It highlights syntax as you type, and the result comes back as a table in the same window.

Running a SQL query in mssql-cmd's terminal interface

The interface is driven from the keyboard - arrow keys, Enter, Esc - so it works over SSH and in any terminal, including the ones that cannot open a window at all. Long running imports and exports show a progress bar instead of leaving you wondering whether anything is happening.

What it will not do

Related

The mode itself: interactive mode. The result view: viewing results. Non-interactive: shell scripts, batch mode. Connecting first: nothing installed, connecting.