I've been reading on Jobs and ways to execute an SSIS package dynamically by passing parameters of dates, and I was wondering if my thinking is good or not.

My requirements:

* different employees might need to be able to execute the package with their own dates.
* employees shouldn't be able to alter or run the job it self(they don't even need to know of the job)

I saw that this is possible through [using stored procedures and web applications to build a dynamic job .](https://sunilreddyenugala.wordpress.com/2011/07/15/real-time-job-scheduling/) Though it seems complicated and require a bit more time.

My approach : Using environment variables. [I saw the last answer by the OP in this topic about changing the values of them before execution.](https://social.msdn.microsoft.com/Forums/sqlserver/en-US/26f3257f-34f3-486b-ac15-7d0c44b310e4/pass-dynamic-value-to-ssis-package?forum=sqlintegrationservices)

So I was wondering if I can do this (and if it's a good enough solution) :

* Use environment variables
* Build a stored procedure (Not necessarily SP, could be a web app or something) that the employees will be able to use, and sent parameters to.
* The stored procedure will set the environment variables
* The stored procedure will then execute a job, which executes the package(By executing with a job, will the values inside the step be used? or the environment variables?)

Should I go farther with this approach , or should I change it to another one ? 

**EDIT:** Thanks to [@PacoDePaco answer](https://stackoverflow.com/a/46296017/5353753) I've manage to come up with this:

```
EXEC [SSISDB].[catalog].[create_execution] @package_name=N'CalculateReports.dtsx',
                                           @execution_id=@execution_id OUTPUT,
                                           @folder_name=N'Packages', 
                                           @project_name=N'HeshbonAmit',
                                           @use32bitruntime=False, 
                                           @reference_id=Null  

Select @execution_id  

DECLARE @var0 sql_variant = N'2017-04-01 00:00:00'  
EXEC [SSISDB].[catalog].[set_execution_parameter_value] @execution_id, @object_type=20, @parameter_name=N'startDate', @parameter_value=@var0  
DECLARE @var1 sql_variant = N'2017-07-01 00:00:00'  
EXEC [SSISDB].[catalog].[set_execution_parameter_value] @execution_id, @object_type=20, @parameter_name=N'EndDate', @parameter_value=@var1  
DECLARE @var2 sql_variant = N'2017-06-30 00:00:00'  
EXEC [SSISDB].[catalog].[set_execution_parameter_value] @execution_id, @object_type=20, @parameter_name=N'shiaruchDate', @parameter_value=@var2  

EXEC [SSISDB].[catalog].[start_execution] @execution_id  
GO  

```

But it throws an error:

> 
> Cannot access the package or the package does not exist. Verify that the package exists and that the user has permissions to it.
> 
> 
> 

The project is deployed in SSMS, and is located it this path :

Intergration service catalogs -> SSISDB -> ssis projects -> projects -> HeshbonAmit -> Packages -> CalculateReports.dtsx

My SSIS has 3 package parameters of type string -> startDate, endDate, shiaruchDate .

I have SSIS\_ADMIN rule, so why is this failing ?