SQL Server Agent Jobs Log custom messages in Job History

感情迁移 提交于 2019-12-01 10:38:04

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.

I haven't done it for a while, but I believe text generated by a PRINT statements in the code executed by the job will end up in the history table. If that doesn't work, RAISERROR with severity less than 11 should do it. (11 and up definitely will, but then jobs are marked as having failed.)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!