problem with variable that not change by execute

  • hi i have a variable that change using execute sql task

    variable 1 = [weekCode]

    select max(week_num) as [weekCode] from L_Periods

    i have also second variable that make select with variable 1:

    strSql: "select * from Data WHERE WEEK =" + (DT_WSTR, 25)@[User::weekCode]

    and i open oledb source and choose sql by variable and choose the variable 2 : strSql

    but i cant see that variable 1 change

    can shomwone tell me why or another way to solve it?

    thanks

  • If you're editing your package in BIDS or SSDT then the value shown will be the value at design time, not the value at run time. Do you have evidence that the runtime value is incorrect? How are you setting the value of variable1?

    John

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

    yes i get error because week variable is integer and when i put it on second variable is failed

    ""select Week,StoreCode from DataFromVed_2016_New WHERE Week="+(DT_WSTR, 4)@[User::weekCode]

  • hi i see the problem:

    at sql task query i used select and assign the reaulto first variable but is not set i dont know why

  • Are you using the Result Set page? If so, don't - it's for result sets, not scalar values. Use Parameter Mapping instead.

    John

  • hi

    im store the resault from :"select max()..."

    by : single row

    ist not ok?

    the error say that variable is empty?!

  • No. It's still a result set, not a scalar value, even if your result set happens to have only one row and one column. Use Parameter Mapping instead.

    John

  • thanks i'll try parameter mapping

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

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