SQLCMD输出到日志文件以进行存储过程执行

发布于 2025-02-07 01:58:51 字数 692 浏览 1 评论 0原文

尝试从Linux框运行以下命令,

sqlcmd -S<server> -d<db> -U<login> -P<pwd> -i /scripts/StoredProcedure1.sql -o /logs/output.log

如果SP在SSMS中执行,则通常会给出

Commands completed successfully.
Completion time: 2022-06-12T18:28:18.4580782-04:00

,但是在output.log中并未捕获它,因为它仅为零字节。

我如何也捕获该输出。

尝试了这些不同的组合

  1. -r [0 | 1](到stderr的msgs) - 并且它没有起作用
  2. -m error_level-并且它没有起作用
  3. https://ss64.com/nt/syntax-redirection.html - 它没有起作用,

这可能是我缺少一些愚蠢的东西或仅仅是错误的组合。谁能在这里帮忙。

Trying to run this below command from a Linux box,

sqlcmd -S<server> -d<db> -U<login> -P<pwd> -i /scripts/StoredProcedure1.sql -o /logs/output.log

If the SP is executed in SSMS it would normally give

Commands completed successfully.
Completion time: 2022-06-12T18:28:18.4580782-04:00

However this is not getting captured in the output.log as it is only of zero bytes.

How do I capture that output too.

Tried these, different combinations

  1. -r[0 | 1] (msgs to stderr) - and it did not worked
  2. -m error_level - and it did not worked
  3. https://ss64.com/nt/syntax-redirection.html - and it did not worked

May be i'm missing something silly or just putting in wrong combination. Could anyone help here.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文