I need to alter a database using a batch file, for a simple example, drop a table. I´m using local SQL Express (SQL Server 2008 R2) with user sa and its passwor
sa
You can do like this
sqlcmd -S -U sa -P sapassword -i inputquery_file_name -o outputfile_name
From your command prompt run sqlcmd /? to get all the options you can use with sqlcmd utility
sqlcmd /?
sqlcmd