SQL Server代理作业在作业历史记录中记录自定义消息 [英] SQL Server Agent Jobs Log custom messages in Job History

查看:367
本文介绍了SQL Server代理作业在作业历史记录中记录自定义消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在作业历史记录消息中记录来自SQL Server代理作业的自定义消息? 如果不是,那么做这种事情的最好方法是什么?

Is it possible to log custom messages from your SQL Server Agent job in the job history messages? If not what's the best way to go about doing such a thing?

推荐答案

对于T-SQL作业步骤,可以使用print语句.对于CmdExec步骤,在可执行文件中使用Console.Writeline.如果有很多输出,则默认情况下,SQL Agent将不会保留所有字符,而只会保留一定数量的字符.要使其保留一个步骤的所有输出,请转到步骤属性高级",然后选中在历史记录中包括步骤输出"复选框.

For T-SQL job steps, you can use the print statement. For CmdExec steps, use Console.Writeline in your executable. If there is a lot of output, then by default SQL Agent will not keep all of, and will only keep a certain number of characters. To have it keep all output for a step, you go to the step properties, Advanced, and check the "Include step output in history" checkbox.

这篇关于SQL Server代理作业在作业历史记录中记录自定义消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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