Invalid character value for cast specification

  • I have an "Execute SQL Task"

    with

    input parameter - GlobalVariable gv_RF_ID

    output parameter - Globalvariable gv_TEXT_INFO

    gv_RF_ID is INT (default 10322)

    gv_TEXT_INFO is String

    Here is SQL statement:

    SELECT TEXT_INFO FROM RF_INDEX WHERE RF_ID = ?

    When I execute this Step I get an error

    "Invalid character value for cast specification"

    I ran this statement in QA, no problems.

    SELECT TEXT_INFO FROM RF_INDEX WHERE RF_ID = 10322

  • It appears to be due to using an input variable in the same exec sql that creates an output variable. 

    Here is one way to get around it:

    1 - run ExecSQL 1 to capture output variable in global gVar

    2 - run active x script to create global sql string on the fly

         sSQL = "select myField1, myField2 from myTable "

         sSQL = sSQL & " where myField1 = " & DTSGlobalVariables("gVar").Value

         DTSGlobalVariables("gSQL") = sSQL

    3 - run Dynamic Properties Task

         set SourceSQL string of ExecSQL 2 to gSQL

    4 - run ExecSQL 2

    Another approach that I like to use a lot, is to store output values in a table.  Say, for example, I pull the max report date available from some source and I need that date in a number of other dts processes.  I write the date to a table and use it over and over throughout processing.  This is also handy because you can check the value in the table while processes are running.

    [font="Courier New"]ZenDada[/font]

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

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