Error when Execute SQL Task don't return rows

  • Hi everybody, I have a Execute SQL Task with the follow:

    ResultSet in SingleRow

    SQLStatement: select FLAG_PRO as Flag_Arch from CARGA_ARCHIVO where FEC_1RALINEA_ARCH=?

    Result Set: ResultName->FlagArch, Variable Name->User::FlagArch

    When I execute the package run without problems where found a term in FEC_1RALINEA_ARCH but when not found any value, show this error: An error ocurred while assigning a value to variable "Flag_Arch": "SingleRow result set is specified, but no rows were returned"

    Please can tell me how I can do it for assign a value to my variable User::FlagArch when dont return rows.

    Thanks a lot by your help.

  • You could change you SQL Statement to return a value if there is no record returned in your table.

    select isnull(FLAG_PRO, 'Unknown') as Flag_Arch from CARGA_ARCHIVO where FEC_1RALINEA_ARCH=?

    Of course the value you return would be based upon you own business requirements.

  • Thanks SSC Veteran!

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

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