problem with JOB

  • I am trying to run the following query:

    BEGIN

    DECLARE @Job varchar(200)

    SET @Job = DB_Name()+' - p_Execute'

    EXEC msdb..sp_start_job @Job

    END

    and got the following error:

    Server: Msg 14262, Level 16, State 1, Procedure sp_verify_job_identifiers, Line 61

    The specified @job_name ('chemsyslive - p_Execute') does not exist.

    Anybody can get me some help on this?

    Thank you.

  • It appears that the variable you are building does not match the name of the job you are trying to run. Is that the valid name?

    David

    David

    @SQLTentmaker

    “He is no fool who gives what he cannot keep to gain that which he cannot lose” - Jim Elliot

  • What do you mean "does not match the name of the job you are trying to run"? Where can I find the name of jobs?

  • msdb..sp_start_job is to start a SQLAgednt job to running. These can be found by using EM to drill thru the server to Management/SQLServerAgent/Jobs (or something like, sorry no EM in front of me right now). However what are you expecting to happen when you exect this query?

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • Thank you all. Now I know how to create and execute a job in SQL Server.

    However, I encounter another problem: when a job fails, I can't re-start it using "Start Job". The way I am doing now is to delete and re-create a same job. Anyone has smarter idea than mine?

    Thank you.

  • Should not matter, in fact I have two processes like this that purposely fail and start job never gives me an issue. What error do you get?

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply