-1

How can I execute these series of commands in batch file? It only executes the first line which is the sqlcmd -S ********\SQLEXPRESS -U sa -P *****:

sqlcmd -S ********\SQLEXPRESS -U sa -P *****

USE Database
GO
SELECT * FROM TBLPERSON
GO
aschipfl
  • 33,626
  • 12
  • 54
  • 99

1 Answers1

2

You can use the following command.

SQLCMD -S <server> -d <database> -U <user> -P <password> -Q "SELECT * FROM TBLPERSON"

Check out the SQLCMD documentation for more here.

Priyan Perera
  • 560
  • 1
  • 7
  • 20