title: Writing to the history of a SQL Agent Job
body: <p>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.</p>
  
  <p>I was using VBScript in this instance, and noted that I could use the Error object to record info in the history, for example:</p>
  
  <pre><code>Err.Raise 999, "The code died"
  </code></pre>
  
  <p>If you right-click the job and choose 'View History' then the error number and description are there for all to see.</p>
  
  <p>But what about successful completion? Can i <code>Return</code> a value somehow? It would be nice to say something like "Finished OK after actioning 34 files" or whatever.</p>
  
  <p>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.</p>