Help Using Sp_help_job
Oct 5, 2007
Can anybody help me. I have a job 1 , job 2 , job 3 and job 4. In job 1 i call job 2 in step 1 and job 3 in step 2 and job 4 in step 3. I call job2 , job 3 and job 3 by EXEC dbo.sp_start_job but before completion of job 2 it goes to job 3, so for job 4 also. i donot know how to use exec msdb.dbo.sp_help_job for job status completion.
View 2 Replies
May 29, 2007
Is there a way to calculate how long each job takes to run using sp_help_job or similar stored procedure? Is last_run_time the clock time or duration? I am getting values like 40000 and 50000 under last_run_time but don't know what that is.
Notalian
View 1 Replies
View Related
Sep 6, 2007
Hello,
Could someone give me a code sample of how to extract @execution_status into a variable from sp_help_job in t-sql?
Thank you
View 3 Replies
View Related
Mar 13, 2008
exec msdb.dbo.sp_help_job @job_name = 'job_name', @job_aspect='JOB'
I've been reading a lot of stuff about this lately, i've tried severals solutions but none worked.
The case is pretty much standard: from query analyzer/any other software it works if i execute it by hand. From my piece of software it fails miserably (managed code, .NET 2.0) with "A severe error occurred on the current command. The results, if any, should be discarded."
Here is the call stack:
Stack : at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.SetMetaData(_SqlMetaDataSet metaData, Boolean moreInfo)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader()
at <my code which checks the status of the stored procedure is listed here>
The point is that if the SQL user is made sysadmin it works. As I understood from the "Books online" the SQL Server agent uses the account specified using xp_sqlagent_proxy_account when executing jobs or commands for users who are not members of the sysadmin fixed server role.
I tried that too, the xp_sqlagent_proxy_account didnt print out any error, and "exec master.dbo.xp_sqlagent_proxy_account N'GET' "returned no records. Obviously the execution of "sp_help_job" still fails with the above exception.
How can I run "sp_help_job" with an user which is not part of the sysadmin role?
View 3 Replies
View Related
Nov 7, 2007
Hi everyone,
I want to check if a job is currently running before calling sp_start_job. I just don't know how to read execution_status returned by sp_help_job in my query.
Any ideas
Thank you
View 10 Replies
View Related
Feb 7, 2008
Currently, user apple can exec sp_help_job (system stored procedure) in database msdb on Server/Instance name CALFI303 but it doesn€™t return any records. What permissions I need to give to the User apple ? If I sign on with sa, it returns the records with no problem.
View 1 Replies
View Related