Getting Return Values for Exec statments

  • Hi

    I am using the sp;

    msdb.dbo.sp_Start_job @Job_Name = 'Cancer Dataset CSV Output'

    What i want to know is how do i find the return value. Reading the Help it is either 0 or 1 but how do i get this value?

    i have tried using an if statement before the exec then = 1, but it does not work.

    Cheers

  • Try:

     
    
    declare @retcode int
    exec @retcode = msdb.dbo.sp_Start_job @Job_Name = 'Cancer Dataset CSV Output'
    select @retcode

    Cheers,

    - Mark


    Cheers,
    - Mark

Viewing 2 posts - 1 through 1 (of 1 total)

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