I am trying to execute a SSIS package with a duration of time down to the SSIS package
USE SSISDB;
DECLARE @execution_id BIGINT
EXEC [SSISDB].[catalog].[create_execution]
@package_name=N'PackageName.dtsx',
@folder_name=N'Projects',
@project_name=N'ProjectName',
@use32bitruntime=False,
@reference_id=Null,
@execution_id=@execution_id OUTPUT
--SELECT @execution_id
DECLARE @var0 smallint = 1
EXEC [SSISDB].[catalog].[set_execution_parameter_value]
@execution_id,
@object_type=50,
@parameter_name=N'LOGGING_LEVEL',
@parameter_value=@var0
/* Attempt to use a variable to execute in the SQL as a parameter */
EXEC [SSISDB].[catalog].[set_execution_parameter_value]
@execution_id,
@object_type=20,
@parameter_name=N'RunDuration',
@parameter_value=10080 /*1 week*/
EXEC [SSISDB].[catalog].[start_execution] @execution_id
GO
I have a variable in the SSIS package called User::Duration
I have a SQL Task that I want to use this input in a SQL command:
SQL Statement
Parameter mapping
DECLARE @DURATION SMALLINT; /* I think the variable would go here as an "= ?" but I am not sure of the rest
/* Need to research how to make @Duration a variable of the SSIS package. */
DECLARE @TIME DATETIME = DATEADD(mi,-@DURATION,GETDATE());
Once I set “@TIME” the rest of the scripting does stuff.
I tried to just get the variable to run but it does not seem to set the @DURATION and the SSIS package fails.
I am hoping to get a scheduled task > correct SSIS execution scripting (hopefully I am close) > the SSIS package Variable to contain the inputed number > the inputed number be able to use in a SQL task, sql command.
MRSKINNMAN is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.