Title: Run Transact-SQL Commands with the sqlcmd Utility - SQL Server | Microsoft Learn
Open Graph Title: Run Transact-SQL Commands with the sqlcmd Utility - SQL Server
Description: The sqlcmd utility lets you enter Transact-SQL statements, system procedures, and script files using different modes, using go-mssqldb or ODBC to run T-SQL batches.
Open Graph Description: The sqlcmd utility lets you enter Transact-SQL statements, system procedures, and script files using different modes, using go-mssqldb or ODBC to run T-SQL batches.
Opengraph URL: https://learn.microsoft.com/en-us/sql/tools/sqlcmd/sqlcmd-utility?view=sql-server-ver17
Domain: docs.microsoft.com
| color-scheme | light dark |
| twitter:card | summary_large_image |
| og:type | website |
| og:image:alt | Microsoft Learn |
| og:image | https://learn.microsoft.com/en-us/media/open-graph-image.png |
| platform_id | c89bca61-b723-36fd-2a10-e0aeb5e85a23 |
| scope | sql |
| locale | en-us |
| uhfHeaderId | MSDocsHeader-DocsSQL |
| page_type | conceptual |
| toc_preview | true |
| feedback_system | Standard |
| feedback_product_url | https://feedback.azure.com/d365community/forum/04fe6ee0-3b25-ec11-b6e6-000d3a4f0da0 |
| feedback_help_link_url | https://learn.microsoft.com/answers/tags/191/sql-server |
| feedback_help_link_type | get-help-at-qna |
| recommendations | true |
| breadcrumb_path | ../../breadcrumb/toc.json |
| monikerRange | >=aps-pdw-2016 || =azuresqldb-current || =azure-sqldw-latest || >=sql-server-2017 || >=sql-server-linux-2017 || =fabric-sqldb |
| ms.update-cycle | 365-days |
| author | rwestMSFT |
| ms.author | randolphwest |
| ms.reviewer | dlevy |
| ms.date | 2026-01-29T00:00:00Z |
| ms.service | sql |
| ms.subservice | tools-other |
| ms.topic | concept-article |
| ms.collection | data-tools |
| ms.custom | ignite-2025 |
| zone_pivot_groups | cs1-command-shell |
| document_id | 8da1f57b-a8fd-cca7-4cf0-9d594d365062 |
| document_version_independent_id | 60c46780-6a03-7958-c77a-e7c94e3b9e85 |
| updated_at | 2026-07-21T00:29:00Z |
| original_content_git_url | https://github.com/MicrosoftDocs/sql-docs-pr/blob/live/docs/tools/sqlcmd/sqlcmd-utility.md |
| gitcommit | https://github.com/MicrosoftDocs/sql-docs-pr/blob/4f43f815712bfe38231ce50021bfd788a7269693/docs/tools/sqlcmd/sqlcmd-utility.md |
| git_commit_id | 4f43f815712bfe38231ce50021bfd788a7269693 |
| monikers | sql-server-ver17 |
| default_moniker | sql-server-ver17 |
| site_name | Docs |
| depot_name | SQL.sql-content |
| schema | Conceptual |
| toc_rel | ../../toc.json |
| pdf_url_template | https://learn.microsoft.com/pdfstore/en-us/SQL.sql-content/{branchName}{pdfName} |
| word_count | 7014 |
| config_moniker_range | =azuresqldb-current || =azuresqldb-mi-current || =azure-sqldw-latest || >=aps-pdw-2016 || >=sql-server-2017 || >=sql-server-linux-2017 || =fabric || =fabric-sqldb |
| asset_id | tools/sqlcmd/sqlcmd-utility |
| moniker_range_name | 566ce1900aff08773acb307531080631 |
| item_type | Content |
| source_path | docs/tools/sqlcmd/sqlcmd-utility.md |
| previous_tlsh_hash | 74EF6303A72CD702FF829E06255EAB5171F2CB4D65A0BF48003D1593EA2A2D33576989D6D727AB88273A238311D2215DE2C5AB39C1AE236157555C6CC34CB217FB8D3FBBF4 |
| github_feedback_content_git_url | https://github.com/MicrosoftDocs/sql-docs/blob/live/docs/tools/sqlcmd/sqlcmd-utility.md |
| markdown_url | https://learn.microsoft.com/en-us/sql/tools/sqlcmd/sqlcmd-utility?view=sql-server-ver17&accept=text/markdown |
| cmProducts | https://microsoft-devrel.poolparty.biz/DevRelOfferingOntology/1433a524-c01f-4b87-beab-670c040dea4f |
| spProducts | https://microsoft-devrel.poolparty.biz/DevRelOfferingOntology/312f1f05-a431-4193-8a4d-e6245d5966de |
Links:
Viewport: width=device-width, initial-scale=1.0