Assigning values to global Variables at Run time

  • Hi

    I am assigning value to global variable using script task

    Dts.Variables("gvRunDt").Value = RunDt

    Here "gvRunDt" is global variable to which i want to assign a value at run time .The value comes from RunDt

    I am using this

    Dts.Variables("gvRunDt").Value = RunDt

    But i am unable to assign the value.Please let me know is there any way to assign a value to global vairable

    Thanks

  • sudheer_1185 (11/26/2008)


    Hi

    I am assigning value to global variable using script task

    Dts.Variables("gvRunDt").Value = RunDt

    Here "gvRunDt" is global variable to which i want to assign a value at run time .The value comes from RunDt

    I am using this

    Dts.Variables("gvRunDt").Value = RunDt

    But i am unable to assign the value.Please let me know is there any way to assign a value to global vairable

    Thanks

    When you say you are unable to assign a value, what do you mean? Do you receive an error in your package or does the value not get updated? I assume that RunDt is a variable you are declaring elsewhere in your script task, is it possible that this value is NULL or represents an incompatible data type?

  • You are write RunDt is already declared and i am getting value from substring fun.I want to assign that value to the "gvRunDt" which is global variable.

  • Again, how is it that you determine that there is a problem? Does your package fail or are you getting incorrect output?

    You might also post some of your script code here to help troubleshoot.

  • Error: The type of the value being assigned to variable "User::gvRunDt" differs from the current variable type. Variables may not change type during execution. Variable types are strict, except for variables of type Object.

    This is the error iam getting.I decalred "gvRunDt" as String and gvRunDt as String.

    SUDHEER

  • Check your variable declaration by right-clicking in your control flow pane and choosing Variables. Make sure that you have set your SSIS variable to be of type "String". The default data type for SSIS variables is Integer, fyi.

  • I have Declared that variable as String in package variable....But still i m facing the error..

  • Can you post your script code?

Viewing 8 posts - 1 through 7 (of 7 total)

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