SQL Server Agent Jobs Log custom messages in Job History

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?

Answers


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.)


Need Your Help

How do I find-file recursively in directories

emacs

Often, I know the file name but don't remember or find it cumbersome to specify the exactly directory. I'd like to be able to do find-file x/y/*/some_file.txt where * would allow searching in recur...

Hidden Markov models package in R

r machine-learning hidden-markov-models information-extraction

I need some help implementing a HMM module in R. I'm new to R and don't have a lot of knowledge on it.