有没有办法抑制“x rows受影响”从命令行在 SQLCMD 中?
有没有办法从命令行抑制 SQLCMD 中的“受影响的 x 行”?
我正在运行 MSBuild 脚本,不希望它堵塞我的构建服务器上的日志。
我不想在每个脚本中添加“SET NOCOUNT ON”,所以如果有一种方法可以从命令行执行此操作,那就太棒了。
Is there a way to suppress "x rows affected" in SQLCMD from the command line?
I'm running an MSBuild script and don't want it clogging up my log on my build server.
I'd rather not have to add "SET NOCOUNT ON" in every script, so if there's a way to do it from the command line, that would be fantastic.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
创建一个启动脚本并在脚本中设置 SET NOCOUNT ON 怎么样(将脚本分配给 SQLCMDINI 环境变量)。 http://msdn.microsoft.com/en-us/library/ms162773.aspx
What about creating a startup script with SET NOCOUNT ON in the script (assign the script to the SQLCMDINI environment variable). http://msdn.microsoft.com/en-us/library/ms162773.aspx
-i
和-q
选项 是互斥的。创建一个名为 setnocount.sql 的文件,其内容为:
您也许可以使用多文件功能执行
-i setnocount.sql,otherscript.sql
操作,并有效地“包含”公共第一个文件。The
-i
and-q
options are mutually exclusive.Create a file named setnocount.sql with the content:
And you might be able to do
-i setnocount.sql,otherscript.sql
using the multiple files feature and effectively an "included" common first file.您还可以在
-Q
参数中运行多行,用分号分隔,如下所示:
You can also run multiple lines in the
-Q
parameter, separated by semicolon, like beloweg: