Hi,
I have a small macro that tests for certain conditions as part of a larger SQL Server job. It returns one of various exit codes that indicate what things wrong, but I'd like to enhance it so that all conditions are checked before it returns success or failure.
Right now, when I encounter an error, I exit with
Exit>2
And then I check the log, go look up what a 2 means, I fix it, and I run it again to see if anything else fails. What I'd rather do is to print descriptions into the SQL Server job history and then just fail after I check everything.
If I was running a SP, I'd simply include code that says
PRINT ** this is the message that goes in my job history **
How can I do that with MS? I'd rather not connect to db, issue SQL to print, because that involves un/pw issues.
PS: I know all about message boxes, writing to a log, etc. I'm not looking for a workaround. I want to get my message in the SQL Server log. Thanks.
Pass Text to SQL Server Job History - SOLVED
Moderators: JRL, Dorian (MJT support)
Pass Text to SQL Server Job History - SOLVED
Last edited by mightycpa on Tue Jan 10, 2017 5:38 pm, edited 1 time in total.
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey
Re: Pass Text to SQL Server Job History
Solved! Two steps:
use SOWriteLn
Compile as a Console app
thanks
use SOWriteLn
Compile as a Console app
thanks
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey