0

I'm looking for a way to make the below commands a bit more automated. I would like to be able to use just a simple batch file if possible.

sqlcmd /S localhost\SQLEXPRESS /U [dbusername] /P [dbpassword]

1> drop database datastore

2> go

n1ch0las
  • 1
  • 2
  • When you read the help file for the `SQLCMD` did you not see the `-i` option? – Squashman Jul 17 '18 at 12:00
  • 3
    Possible duplicate of [Executing set of SQL queries using batch file?](https://stackoverflow.com/questions/21554062/executing-set-of-sql-queries-using-batch-file) – Squashman Jul 17 '18 at 12:09

1 Answers1

0

Have you tried this:

sqlcmd /S localhost\SQLEXPRESS /U [dbusername] /P [dbpassword] <cmds.txt

where cmds.txt is a file containing your commands (the drop and the go commands).