April 16, 2009 at 7:28 am
Hello Guys and Girls,
As we all know, SQL Agent will not be shipped with SQL Express and the versions following. I am creating a stand alone application that will replicate SQL Agent - and my problem lies in the fact that I would like to have a Job History page, just like the one in SQL Agent; The first step would be to have the output piped to a text file, but I do not know how the output is created. I am guessing it should be a stored procedure. If anyone could give advise on this one, I would greatly appreciate it...:-D
April 16, 2009 at 8:20 am
In the msdb database check the following stored procedure:
sp_sqlagent_log_jobhistory - I believe it is what you are looking for. It is a long proc so read it all.
April 29, 2009 at 7:01 am
to get the hex value of your job:
select job_id from msdb.dbo.sysjobs where name = 'your_job_name'
to run the sp mentioned above use the following format:
EXECUTE msdb.dbo.sp_sqlagent_log_jobhistory
@job_id = '374DECBA-F44D-48BB-97A9-DDBBBC100F13', -- this is the value returned by the query above
@step_id = 0,
@sql_message_id = 0,
@sql_severity = 0,
@run_status = 1,
@run_date = 20090429,
@run_time = '165100',
@run_duration = 1,
@operator_id_emailed = 0,
@operator_id_netsent = 0,
@operator_id_paged = 0,
@retries_attempted = 0,
@message = N'The job succeeded'
this does however not return a listing with history information, it just says: "Command(s) completed successfully."
:hehe: Am I missing something?
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply