Problem with Global Variables!!!!!

  • Hi Pals,

    Need some urgent help.

    Inside my SSIS PACKAGE , declared a global variable with name as "Obj" whose datatype is of "Object" datatype and is getting used inside a Foreachloop container.One more variable "param_4" which is used to assign a value inside a Foreachloop container.

    Also having other 3 other variables of "String" dataype. I am calling this package from a stored procedure.

    I have a question here. Cant we set a value for a variable whose datattype is "Object"?

    SQL Command :

    "C:\Program Files\Microsoft SQL Server\90\DTS\Binn\DTExec.exe" /F "D:\PackageStore\Package.dtsx"

    /SET "\Package.Variables[User::param_1].Properties[Value]";"101"

    /SET "\Package.Variables[User::param_2].Properties[Value]";"2008JanuaryVersion1.1"

    /SET "\Package.Variables[User::param_3].Properties[Value]";"01023"

    /SET "\Package.Variables[User::Obj].Properties[Value]";""

    /SET "\Package.Variables[User::param_4].Properties[Value]";""

    And when i execute this package at DOS prompt, am getting the below error.

    Argument ""\Package.Variables[User::Obj].Properties[Value];"" for option "set" is not valid.

    Note :: Scope of all the variables are set to "Package level".

    What i have done is i commented the last 2 lines of code and re ran the command.

    This time it is getting executed very fine. My doubt is , what could be problem if i set

    a variable of "Object" datatype. IS is there any limitation for this or else is there any particular limitations or hard fast rules for variables being used inside the ForEachLoopContainer.

    Any thoughts?????

    Any help would be appreciated.

    Thank You!

  • You cannot set an object type variable like this. What exactly do you want to set? Object types are generally used to store full resultset from a query or fill it will data set or array.

    HTH

    Mukti

  • Mukti (1/12/2009)


    You cannot set an object type variable like this. What exactly do you want to set? Object types are generally used to store full resultset from a query or fill it will data set or array.

    HTH

    Mukti

    Hi Mukti,

    Thanks for your response.Basically my question is,

    Whatever variables we declare inside a need to set before calling/executing the package. Right?

    I am calling the package from a stored procedure in which we get the parameter from external source i.e from front-end application with which we are not interested as of now. So , am using a ForeachLoopContainer inside my SSIS PACKAGE and for which assigning a result set which is retreived from a SELECT statement inside an Execute SQL Task.

    So what am doing here is trying to assign ""/NULL value while calling the package from the command line.

    And finally ended up in getting the below error.

    Argument ""\Package.Variables[User::Obj].Properties[Value];"" for option "set" is not valid.

    and that [User::Obj]variable is of "Object" data type. My question here is can't we set ""/NULL value from the command line to Object datatype variables?

    Hope you understand what i am trying to say!

  • You do not need to set all variables... only those that you need to set at run-time (as input parameters).

  • Timothy is correct. Furthermore, variables of type object must be mapped to a collection or recordset. You would typically do this inside the packge by an ExecuteSQL task.

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

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

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