{
  "id": "sqlcmd",
  "name": "sqlcmd",
  "homepage": "https://github.com/microsoft/go-sqlcmd",
  "description": "Microsoft's command-line tool for querying and managing SQL Server.",
  "executables": [
    "sqlcmd"
  ],
  "dotfiles": {
    "paths": [],
    "secret": [
      "~/.sqlcmd/sqlconfig"
    ],
    "side_effect": false
  },
  "commands": {
    "format": 1,
    "label": "Run SQL Server queries",
    "description": "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.",
    "quality": "ai-draft",
    "parser": {
      "end_of_options": "--",
      "interleave": "permute",
      "long_equals": false,
      "short_attached": false,
      "short_bundles": false
    },
    "source": [
      {
        "id": "docs",
        "kind": "manual",
        "url": "https://learn.microsoft.com/en-us/sql/tools/sqlcmd/sqlcmd-utility",
        "revision": "2026-10-27",
        "evidence": "-d db_name\nIssues a USE <db_name> statement when you start sqlcmd.\n-E\nUses a trusted connection instead of using a user name and password to sign in to SQL Server.\n-G\nUse this option to authenticate with Microsoft Entra when connecting to Azure SQL Database or Azure Synapse Analytics.\n-S [protocol:]server[\\instance_name][,port]\n-U login_id\n-i input_file[,input_file2...]\nIdentifies the file that contains a batch of Transact-SQL statements or stored procedures.\n-o output_file\nIdentifies the file that receives output from sqlcmd.\n-Q \"cmdline query\"\nExecutes a query when sqlcmd starts and then immediately exits sqlcmd.\n-C\nUse this option to configure the client to implicitly trust the server certificate without validation.\n-b\nSpecifies that sqlcmd exits and returns a DOS ERRORLEVEL value when an error occurs.\n-W\nRemoves trailing spaces from a column.\n-s col_separator\nSpecifies the column-separator character.\n"
      }
    ],
    "field": [
      {
        "id": "server",
        "label": "Server",
        "description": "[protocol:]server[\\instance][,port]",
        "type": "string",
        "option": [
          "-S"
        ],
        "sources": [
          "docs"
        ]
      },
      {
        "id": "database",
        "label": "Database",
        "type": "string",
        "option": [
          "-d"
        ],
        "sources": [
          "docs"
        ]
      },
      {
        "id": "user",
        "label": "Login",
        "type": "string",
        "option": [
          "-U"
        ],
        "sources": [
          "docs"
        ]
      },
      {
        "id": "trusted",
        "label": "Trusted connection",
        "type": "boolean",
        "option": [
          "-E"
        ],
        "sources": [
          "docs"
        ]
      },
      {
        "id": "entra",
        "label": "Microsoft Entra authentication",
        "type": "boolean",
        "option": [
          "-G"
        ],
        "sources": [
          "docs"
        ]
      },
      {
        "id": "trust_cert",
        "label": "Trust server certificate",
        "description": "Skips certificate validation.",
        "type": "boolean",
        "option": [
          "-C"
        ],
        "sources": [
          "docs"
        ]
      },
      {
        "id": "query",
        "label": "Query (run and exit)",
        "type": "string",
        "option": [
          "-Q"
        ],
        "sources": [
          "docs"
        ]
      },
      {
        "id": "input_file",
        "label": "Script file(s)",
        "description": "Comma-separated list without spaces.",
        "type": "path",
        "option": [
          "-i"
        ],
        "path": {
          "kind": "file",
          "role": "input",
          "must_exist": true
        },
        "sources": [
          "docs"
        ]
      },
      {
        "id": "output_file",
        "label": "Output file",
        "type": "path",
        "option": [
          "-o"
        ],
        "path": {
          "kind": "file",
          "role": "output"
        },
        "sources": [
          "docs"
        ]
      },
      {
        "id": "exit_on_error",
        "label": "Exit on error",
        "type": "boolean",
        "option": [
          "-b"
        ],
        "sources": [
          "docs"
        ]
      },
      {
        "id": "trim",
        "label": "Trim trailing spaces",
        "type": "boolean",
        "option": [
          "-W"
        ],
        "sources": [
          "docs"
        ]
      },
      {
        "id": "separator",
        "label": "Column separator",
        "type": "string",
        "option": [
          "-s"
        ],
        "sources": [
          "docs"
        ]
      }
    ],
    "task": [
      {
        "id": "query",
        "label": "Run one query",
        "fields": [
          "server",
          "database",
          "trusted",
          "user",
          "query",
          "exit_on_error"
        ],
        "required": [
          "server",
          "query"
        ]
      },
      {
        "id": "script",
        "label": "Run a script file",
        "fields": [
          "server",
          "database",
          "trusted",
          "user",
          "input_file",
          "output_file",
          "exit_on_error"
        ],
        "required": [
          "server",
          "input_file"
        ]
      }
    ],
    "group": [
      {
        "id": "basic",
        "label": "Basic",
        "fields": [
          "server",
          "database",
          "user",
          "trusted",
          "query",
          "input_file"
        ]
      },
      {
        "id": "advanced",
        "label": "Advanced",
        "fields": [
          "entra",
          "trust_cert",
          "output_file",
          "exit_on_error",
          "trim",
          "separator"
        ]
      }
    ]
  }
}
