sql-serverbatch-filessisflat-file

Pass Value/Variable to Dtsx /SET \Package.Variables[User::NameVariable];"value" ERROR


I want pass a value to ssis package, but i have an error back

I execute with batch, the command

dtexec /F "c:\MyPackage.dtsx" /SET \Package.Variables[User::Valore].Properties[Value];2

This is the error (warning) :

C:>dtexec /F "c:\AnagraficaTOC.dtsx" /SET \Package.Variables[User::Valore].Prop erties[Value];2 Microsoft (R) SQL Server Execute Package Utility Version 10.50.2500.0 for 64-bit Copyright (C) Microsoft Corporation 2010. All rights reserved.

Started: 11:30:10 Warning: 2011-11-12 11:30:10.95 Code: 0x80012017 Source: AnagraficaTOC Description: The package path referenced an object that cannot be found: "\Pa ckage.Variables[User::Valore].Properties[Value]". This occurs when an attempt is made to resolve a package path to an object that cannot be found. End Warning DTExec: Could not set \Package.Variables[User::Valore].Properties[Value] value t o 2. Started: 11:30:10 Finished: 11:30:10 Elapsed: 0.203 seconds

What does this mean? The syntax looks right to me, I checked on many sites, what is wrong? Thanks to all!


Solution

  • Your syntax looks correct assuming your variable is exactly named Valore and lives at the package level scope.

    Variables are case sensitive so if it's named valore, VAlore, etc, it will not match.

    Variables can be created at any level in the program so scope does matter. Locate the variable Valore and verify it's scope is at the package level (the Scope will match the Package.Name property). This is an example of how to reference a variable declared inside a Data Flow Task which is nested inside a Sequence Container.

    \Package\Sequence Container\Data Flow Task.Variables[User::something].Properties[Value]

    I put together a simple package and called it using your input. It worked fine

    C:\src\SSISHackAndSlash\SSISHackAndSlash>dtexec /F ".\AnagraficaTOC.dtsx" /SET \Package.Variables[User::Valore].Properties[Value];2
    Microsoft (R) SQL Server Execute Package Utility
    Version 10.50.2500.0 for 64-bit
    Copyright (C) Microsoft Corporation 2010. All rights reserved.
    
    Started:  8:05:45 AM
    Warning: 2011-11-12 08:05:45.93
       Code: 0x00000000
       Source: Script Task value check
       Description: Valore : 2
    End Warning
    DTExec: The package execution returned DTSER_SUCCESS (0).
    Started:  8:05:45 AM
    Finished: 8:05:45 AM
    Elapsed:  0.328 seconds
    

    I also tested with the above command line from inside a batch file and it too worked as expected.

    Finally, it seems you've scrubbed your input for us

    "dtexec /F "c:\MyPackage.dtsx" /SET \Package.Variables[User::Valore].Properties[Value];2"
    

    vs

    dtexec /F "c:\AnagraficaTOC.dtsx" /SET \Package.Variables[User::Valore].Prop erties[Value];2 
    

    Despite the space in Properties in the second example, I assume that is related to copying values as the error message has a correct path. The first one has quotes in the wrong places (at least when I run it as provided I receive error - cannot find the path specified) Could the issue be that you're looking at an older version of the package (or you have multiple copies of it)?