• I can see where you hard code the value of the variable. What if you don't know what the value you want you SSIS variable value is until run time?

    I am using DTExec in a stored procedure to execute an SSIS package and use \SET to set my SSIS variable from a variable that I have declared in my stored procedure. I need a filedate and the stored procedure can be run multiple times if it was not run. (Example: Stored procedure didn't run Saturday or Sunday. On Monday a "catch up" will be run to get Saturday, Sunday and Monday. The filedate needs to represent the date of the data, so it changes each time the "catch up" process runs.

    DECLARE @filedate VARCHAR(8)

    SET @filedate = '20160521' (Changes to '20160522' the next run; changes to '20160522' the next run; and "today" as 20160523.)

    DECLARE @cmd VARCHAR(1000)

    SET @cmd = 'cd.. && "E:\Program Files\Microsoft SQL Server\110\DTS\Binn\DTExec.exe" /F "\\server\clientfolder\PachageName.dtsx"' /SET "\Package.variables[User::filedate].Value";@filedate

    EXEC master.dbo.xp_cmdshell @cmd

    Error on /SET

    Does anyone know how this can be done?