Detect if package was started manually

  • I have a daily backup package that has a bunch of logic in it. I'd like for the admins to be able to 'r-click run' on either the job or the package and get modified logic in the package (e.g. different path through the package). In other words I need to detect if the job or package was started manually, or from the schedule on the job. Preferably from a script task.

    I can certainly do it with a config paramater, but then I need to go change the parameter in the DB where it's stored, remember to change it back afterward etc. Would be much nicer if I could just detect in the package HOW it was started.

    Thoughts ?

    Jim In FL

  • You could pass in a parameter along with your DTEXEC command?

    Perhaps a separate scheduled job would have the parameter IsScheduled set to 1 and the bat file or non scheduled job you use to run it manually can have it set to 0?

    HTH

    Kindest Regards,

    Frank Bazan

  • You might look at the system variable InteractiveMode and look at this article:

    http://jessicammoss.blogspot.com/2008/03/interactivemode-variable.html

    CEWII

  • My thanks to both responders. Thought that InteractiveMode blog might just do it, but looks like I need to fall back to the config variable plan.

    Thanks again.

    Jim In FL

  • Not quite sure how, but can the package detect 'who' is running it? For the scheduled job, it will be whatever user is running the SQL Agent service - and hopefully this would uniquely identify whether or not the job is running on or off schedule.

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

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

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