variables type issue in execute SQL task

  • Variables on package level are

    User::EntryNo, type is Int32, value is 0

    User::CompanyCode is String, Value is 'COMPANY'

    Execute sql task has the following query

    set @EntryNo = (-1)

    set @EntryNo= (select EntryNo from ProjectEntryNo where CompanyCode=@CompanyCode)

    Parameter mapping

    User::EntryNo mapped to @EntryNo with direction as output and type = Int32 (same as package level)

    User::CompanyCode mapped to @CompanyCode with direction input and Type = string (same as package level)

    I still get a task failure with the message "The type of the value being assigned to variable "User::xxxxx" differs from the current variable type. Variables may not change type during...."

    I even tried to do a convert of the EntryNo field (even though it is integer)

    Any help, please

  • battery_acid_h (10/13/2011)


    Variables on package level are

    User::EntryNo, type is Int32, value is 0

    User::CompanyCode is String, Value is 'COMPANY'

    Execute sql task has the following query

    set @EntryNo = (-1)

    set @EntryNo= (select EntryNo from ProjectEntryNo where CompanyCode=@CompanyCode)

    Parameter mapping

    User::EntryNo mapped to @EntryNo with direction as output and type = Int32 (same as package level)

    User::CompanyCode mapped to @CompanyCode with direction input and Type = string (same as package level)

    I still get a task failure with the message "The type of the value being assigned to variable "User::xxxxx" differs from the current variable type. Variables may not change type during...."

    I even tried to do a convert of the EntryNo field (even though it is integer)

    Any help, please

    You are going about this the wrong way..

    Your query should be:

    SELECT EntryNo FROM ProjectEntryNo WHERE CompanyCode= ?

    Your resultset paramter:

    Single Row

    Your parameter mapping should be:

    Variable Name: User::CompanyCode

    Direction: Input

    Datatype: varchar

    Parameter: 0

    Parameter Size: -1

    Your Result Set:

    Result Name: 0

    Variable Name: User::EntryNo

    That should work for you..

    CEWII

  • I will give it a try

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

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