All apps/sqlcmd

sqlcmd

sqlcmd

Microsoft's command-line tool for querying and managing SQL Server.

Runs as sqlcmd|macOS, Linux, Windows|github.com

Command form

ai-draft · 2 tasks · 12 fields

Connect to SQL Server with sqlcmd and run a query or script file, or open the interactive prompt. Passwords (-P) are left out so they do not land in shell history; contexts and the modern subcommands are not covered.

Opens the form; the finished command lands at your prompt, unrun
otty gui sqlcmd
Run SQL Server queriesExample values, fixed in this page — nothing here reaches a terminal
Basic
Server*
string
Database
string
Login
string
Trusted connection
-E
Query (run and exit)*
string
Advanced
Exit on error
-b
TasksEach one presets the form for one job
Run one query
serverdatabasetrusteduserqueryexit_on_error
Run a script file
serverdatabasetrusteduserinput_fileoutput_fileexit_on_error
ParametersOnly these flags are editable in the form
Server
[protocol:]server[\instance][,port]
string
-S
Database
string
-d
Login
string
-U
Trusted connection
boolean
-E
Microsoft Entra authentication
boolean
-G
Trust server certificate
Skips certificate validation.
boolean
-C
Query (run and exit)
string
-Q
Script file(s)
Comma-separated list without spaces.
path
-i
Output file
path
-o
Exit on error
boolean
-b
Trim trailing spaces
boolean
-W
Column separator
string
-s
SourcesEvery flag above is checked against these
docs
-d db_name Issues a USE <db_name> statement when you start sqlcmd. -E Uses a trusted connection instead of using a user name and password to sign in to SQL Server. -G Use this option to authenticate with Microsoft Entra when connecting to Azure SQL Database or Azure Synapse Analytics. -S [protocol:]server[\instance_name][,port] -U login_id -i input_file[,inp…
manual2026-10-27

learn.microsoft.com

Before it fills your prompt, Otty checks the installed sqlcmd against its version. A form that does not match your version is not offered.