SQLMentor // learn sql server

Tools: SSMS, sqlcmd & Azure Data Studio

SQL Server has three first-party clients — each suited to different tasks. Most teams install all three.

SQL Server Management Studio (SSMS)

SSMS is the long-standing Windows-only IDE built on the Visual Studio shell. It is the richest tool for DBA work: maintenance plans, replication, security, server agent jobs, profiler/extended events, and database diagrams.

Connecting

Open SSMS and fill in the Connect to Server dialog:

  • Server type — Database Engine
  • Server nameMYHOST\SQLEXPRESS, localhost, or tcp:my-azure.database.windows.net,1433
  • Authentication — Windows Authentication, SQL Server Authentication, or Microsoft Entra (Azure AD)

Object Explorer

The left-hand tree walks every object on the server: Databases → HR → Tables → dbo.employees → Columns / Keys / Indexes / Triggers. Right-click anything to script CREATE/ALTER/DROP, generate SELECT/INSERT templates, view dependencies, or run Design for visual table editing.

Query Window

Ctrl+N opens a new query. Useful shortcuts:

Shortcut Action
F5 or Ctrl+E Execute selection (or whole script)
Ctrl+R Toggle results pane
Ctrl+L Display estimated execution plan
Ctrl+M Toggle actual execution plan capture
Ctrl+Shift+M Replace template parameters
F4 Properties window
Alt+F1 on a table name sp_help for that object

Activity Monitor

Ctrl+Alt+A — live view of running processes, waits, recent expensive queries, and data file I/O. The first stop when something feels slow.

sqlcmd

The command-line client. Ships with SQL Server and standalone in the mssql-tools package on Linux/macOS.

# Trusted (Windows) connection
sqlcmd -S MYHOST\SQLEXPRESS -d HR -E

# SQL login
sqlcmd -S localhost -d HR -U sa -P "S3cret!" -Q "SELECT COUNT(*) FROM employees;"

# Run a script file and write output to disk
sqlcmd -S localhost -d HR -E -i deploy.sql -o deploy.log

# Azure SQL with Entra (interactive)
sqlcmd -S my.database.windows.net -d HR -G --authentication-method=ActiveDirectoryInteractive

Useful flags: -Q (run query and quit), -i (input file), -o (output file), -v (define variable), -h -1 (no column headers, useful for piping).

Inside an interactive session:

1> SELECT TOP 3 first_name FROM employees;
2> GO

Type :HELP for the full directive list (:r, :setvar, :exit, :!!).

Azure Data Studio (ADS)

A cross-platform, lightweight editor (Electron/Monaco) — feels like VS Code with database superpowers. Available on Windows, macOS, and Linux. Lacks SSMS's deep DBA tooling but excels at querying and notebooks.

Notebooks

ADS supports SQL notebooks (.ipynb-style) — interleave Markdown documentation with executable T-SQL cells. Each cell runs against the connected database; output (rows, charts, plans) appears below.

-- Cell 1
USE HR;
SELECT department_name, COUNT(*) AS staff
FROM   employees e
JOIN   departments d ON d.department_id = e.department_id
GROUP BY department_name;

Choosing a Tool

Task Best tool
DBA work, maintenance plans, replication, profiler SSMS
Day-to-day querying on macOS/Linux ADS
Reproducible runbooks with prose ADS notebooks
Scripted deploys, CI/CD pipelines sqlcmd
Generating CREATE scripts of existing objects SSMS (Tasks → Generate Scripts)
On macOS or Linux, install sqlcmd via the official mssql-tools18 package or use go-sqlcmd (a modern Go rewrite by Microsoft).

Summary

  • SSMS is the heavyweight Windows IDE — best for full DBA work and rich object scripting.
  • Azure Data Studio is cross-platform with notebooks — best for everyday querying.
  • sqlcmd is the scriptable client — best for automation and CI/CD.
  • Use F5/Ctrl+E to run, Ctrl+M to capture actual plans, Alt+F1 for sp_help.