【问题标题】:How do I suppress the output of a sql query executed through a batch file如何抑制通过批处理文件执行的 sql 查询的输出
【发布时间】:2013-07-05 06:58:00
【问题描述】:

我正在通过一个批处理文件执行一个sql脚本

sqlcmd /S<machine> /Usa /Paaa123  /i "<sql file>" > "results.txt" 

执行上述操作后,结果文件将“(受影响的 8890 行)”作为我要禁止的结果文件的一部分。

【问题讨论】:

标签: sql-server batch-file sqlcmd


【解决方案1】:

好吧,如果您不想导出查询执行的结果,只需删除&gt; "results.txt" 部分即可。

sqlcmd /S /Usa /Paaa123 /i "" 是你应该运行的

【讨论】:

    【解决方案2】:

    试试这个:

    sqlcmd /S<machine> /Usa /Paaa123  /i "<sql file>" | findstr /v /c:"rows affected" > "results.txt"
    

    【讨论】:

      【解决方案3】:

      试试这个:

      sqlcmd /S<machine> /Usa /Paaa123  /i "<sql file>" | findstr /v /g:"file with unwanted spam" > "results.txt" 
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-08-15
        • 2013-10-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-03-16
        • 1970-01-01
        • 2016-02-05
        相关资源
        最近更新 更多