SQL Server 2008:如何获取“消息"选项卡(在 Management Studio 中)使用 powershell 输出 [英] SQL Server 2008: how to get the "Messages" tab (in Management Studio) output with powershell

查看:68
本文介绍了SQL Server 2008:如何获取“消息"选项卡(在 Management Studio 中)使用 powershell 输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 invoke-sqlcmd 来管理我的数据库,它工作正常.我将 Management Studio 中结果"选项卡的输出保存到日志文件中.

I am using invoke-sqlcmd to manage my databases, it works fine. I save the output of the "Results" tab in Management Studio to a log file.

当我执行 BACKUP DATABASE 时,输出在消息"选项卡上完成,我想将其保存在日志文件中.

When I do a BACKUP DATABASE, the output is done on the "Messages" tab and I would like to save it in the logfile.

有没有办法得到那个输出?(或 SQL Server 2008 中存储备份进度和结果的表?)

Is there a way to get that output ? (or a table in SQL Server 2008 that stores the backup progression and results ?)

SQL Server 2008 日志包含一些内容,但不如消息"选项卡详细.

The SQL Server 2008 logs contain something but it is not as verbose as the "Messages" tab.

推荐答案

Invoke-Sqlcmd 不显示消息,例如 PRINT 的输出语句,除非您指定Windows PowerShell - 详细通用范围.例如:

Invoke-Sqlcmd does not display messages, such as the output of PRINT statements, unless you specify the Windows PowerShell -Verbose common parameter. For example:

Invoke-Sqlcmd -Query "PRINT N'abc';" -Verbose

来源

这篇关于SQL Server 2008:如何获取“消息"选项卡(在 Management Studio 中)使用 powershell 输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆