Execute SQL script from command line

后端 未结 4 1118
一向
一向 2020-12-23 09:02

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

4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-23 09:47

    If you use Integrated Security, you might want to know that you simply need to use -E like this:

    sqlcmd -S Serverinstance -E -i import_file.sql
    

提交回复
热议问题