Error while running SSIS package from Stored Procedure

  • If I run the following package, I get error like

    Description: The package path referenced an object that cannot be found: "\Package.Variables[Data_ID].Value". This occurs when an attempt is made to resolve a package path to an object that cannot be found.

    When I run SSIS package without passing paramenter, it works fine but whenever I pass parameter, it throws error.

    DECLARE @ServerName VARCHAR(30), @ReturnValue int, @Cmd varchar(1000),

    @Data_ID int

    SET @ReturnValue = -1 -- successful

    SET @ServerName = 'SCDC312DB'

    SET @Data_ID = 17

    SET @Cmd = N'dtexec /DTS "\MSDB\Package"'+ ' /SERVER ' + @ServerName + ' /CHECKPOINTING OFF /REPORTING V ' + '/SET "\Package.Variables[Data_ID].Value";"' + Cast(@Data_ID As nVarchar(10)) + '"'

    EXECUTE @ReturnValue = master..xp_cmdshell @Cmd--, --NO_OUTPUT

    --RETURN @ReturnValue

    SELECT @ReturnValue [Result]

  • What is the scope of the variable you are trying to adjust. If it is not at the package level this won't work.

    I'd try this:

    '/SET "\Package.Variables[User::Data_ID].Value;17'

    Or for a different level try this:

    '/SET "\Package\SubLevelComponentName.Variables[User::Data_ID].Value;17'

    I'm not sure how important User:: is but that is how I see it in BOL and in my config file when I look at it..

    CEWII

  • You are right. Variable was not defined as a package level. I defined it as a package level and it's working fine.

    Thanks buddy.

  • Glad to hear it, while there is really a lot you can do wrong when building a command line everything you had was nearly "by the book", I had to dig deep..

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply