Looking for a solution to run single executable from multiple jobs in SQL server Agent

Bhupinder Singh 21 Reputation points
2023-01-17T16:52:13.4266667+00:00

Hi,

Problem:

We have various different small executables scheduled as jobs under the SQL Server agent. It becomes challenging to manage these small executables. When there's a small change then we need to update all of them one by one and also sometimes there's code redundancy in some of the exes.

Solution Looking:

I'm thinking to merge all small executables into one single executable for manageability and to avoid code redundancies. However, I still like them to be set up as different jobs under the SQL Server agent but all jobs are referenced to the same single executables with a parameter as Task Name.

Is it the right approach to point multiple different jobs to a single executable?

The reason for having different jobs is that each job different schedule time to run.

Thanks,

Bhupinder

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
8,508 questions
No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Erland Sommarskog 67,721 Reputation points Microsoft MVP
    2023-01-17T21:16:06.1433333+00:00

    My gut reaction is that I can't see anything wrong with multiple jobs running the same executable with different command-line arguments (which I assume is the way you plan have this one big executable to be able to handle the various tasks of the small executables).

    No comments

  2. Seeya Xi-MSFT 12,511 Reputation points Microsoft Employee
    2023-01-18T09:12:54.5933333+00:00

    Hi Bhupinder Singh,

    This is indeed a viable option. After all, it would shorten the code. But you don't have to merge all small executables into one single executable either. You can merge according to your specific level of repetition. You can also merge into multiple executables.

    Best regards,

    Seeya


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    No comments

  3. Bhupinder Singh 21 Reputation points
    2023-01-18T15:09:26.4833333+00:00

    I guess my worry is that if SQL Server Agent runs the same instance of exe when running multiple jobs. If that's the case then it would probably say an error for eg: "exe is already running by another job"


  4. Seeya Xi-MSFT 12,511 Reputation points Microsoft Employee
    2023-01-23T11:07:56.1433333+00:00

    Hi Bhupinder Singh,

    I can't do such a test at the moment. If this error occurs, you might also consider creating a new SQL instance.

    Best regards,

    Seeya


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    No comments