Having just created a SQL Agent Job I thought it would be handy to be able to write a little bit of information into the job's history, in case I wanted to check it later.
I was using VBScript in this instance, and noted that I could use the Error object to record info in the history, for example:
Err.Raise 999, "The code died"
If you right-click the job and choose 'View History' then the error number and description are there for all to see.
But what about successful completion? Can i Return
a value somehow? It would be nice to say something like "Finished OK after actioning 34 files" or whatever.
I'd be interested in VBScript answers this time, but if you know how to do this with T-SQL or CmdExec that would be helpful to know, just in case. Thanks.