Run SQL Queries From Command Prompt

In this article I tell you about how to run sql queries from command prompt.
  • 2291

In this article I tell you about how to run sql queries from command prompt. We can use sqlcmd command to run SQL queries.

Step 1

Go to Start->Run-->Type "cmd"-> OK

sqlcmd1.jpg

Step 2

Type "sqlcmd" command. If you want to run sql query in SQL Server authentication mode, then write username and password also with sqlcmd. And Press Enter.

sqlcmd2.jpg

Step 3

Type following commands and type GO for the batch termination as shown in below screen:

sqlcmd3.jpg

Step 4

You can retrieve this table from Query Editor also.

sqlcmd4.jpg

© 2020 DotNetHeaven. All rights reserved.