if exists(jobschedule)???

  • i can create a job schedule, i can alter a job schedule, I can delete a job schedule....

    I'm assuming there is an easy TSQL way to see if a job schedule exists for a specific job... but I've pulled a bone and can't seem to find it.

    I'm working with an SSIS package, that needs to self schedule for the next quarterly run. I would like to have the SSIS package so an SQL Task to tell me if there is an existing schedule for the job.

    If yes

    {

    Alter the Job Schedule

    } Else

    Create the Job Schedule

    }

    now that's easy to do if i can determine if a schedule exists, and drop true/false into a variable and the branch the package to run one or the other commands.

    I'm still searching.

    Thanks!

  • DOH! found it

    SELECT job_id, [name] FROM msdb.dbo.sysjobs;

    well not quite.

    gives me jobs... not schedules.... will keep looking, it has to be similar.

  • SELECT count(*) FROM msdb.dbo.sysschedules where name = @ScheduleName

    gets a line count that will tell me what I need.

    sry to bother, figured it out.

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

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