[英]How to execute the SQL Script through Batch Script Command from SQL?
我正在尝试从批处理脚本执行.sql文件,但无法执行。 脚本具有多个脚本,例如Create Table,Stored Procedure和GO语句分隔。
我尝试使用以下脚本,但是未执行脚本。
DB Servername : localhost\SQL2017
Authentication : Windows
sqlcmd -E -S localhost\SQL2017\MyDatabase -i C:\SQLScripts\TestScript.sql
尝试以下方法:
sqlcmd -E -S localhost\SQL2017 -d MyDatabase -i C:\SQLScripts\TestScript.sql
您需要使用-d
参数来指定数据库名称。 -S
参数应仅包含服务器名称和实例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.