--
https://stackoverflow.com/questions/15882037/get-return-exit-code-from-a-package-executed-from-a-ssis-catalogue
EXEC [SSISDB].[catalog].[create_execution]
@package_name = N'FixProductType.dtsx',
@execution_id = @execution_id OUTPUT,
@folder_name = N'BI',
@project_name = N'DataCleaning',
@use32bitruntime = False;
EXEC [SSISDB].[catalog].[set_execution_parameter_value]
@execution_id,
@object_type = 50,
@parameter_name = N'LOGGING_LEVEL',
@parameter_value = 1;
EXEC [SSISDB].[catalog].[start_execution] @execution_id;
DECLARE @status AS BIGINT = 1;
WHILE(@status = 1 OR @status = 2 OR @status = 5 OR @status= 8)
BEGIN
PRINT @status
PRINT 'waiting 5 seconds for Package to finish'
WAITFOR DELAY '00:00:5';
SET @status = (SELECT [Status] FROM SSISDB.[catalog].[executions]
WHERE execution_id = @execution_id);
END