Skip to main content
Our Tech Ideas

How to run a SQL query using command prompt without SQL SSMS

Introduction

How to run a SQL query using command prompt without SQL SSMS
Open CMD from Run and run the below command (CMD) to connect with Database engine.

sqlcmd -S WIN-81L2H4SUHDH\MSSQLSERVER,14331

**WIN-81L2H4SUHDH\MSSQLSERVER  --> This should be FQDN**

Then you can run type your SQL query. Once you are done with all your statement then put an enter. Then type Go and put enter. Shown in the below screen shot.

SQLCMD
SQLCMD