Is there a way to suppress “x rows affected” in SQLCMD from the command line?

我的未来我决定 提交于 2019-11-28 07:07:13

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

Cade Roux

The -i and -q options are mutually exclusive.

Create a file named setnocount.sql with the content:

SET NOCOUNT ON;

And you might be able to do -i setnocount.sql,otherscript.sql using the multiple files feature and effectively an "included" common first file.

Rob

You can also run multiple lines in the -Q parameter, separated by semicolon, like below

eg:

-Q "set nocount on;select * from table;delete from table where some_condition=true"
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!