I need help getting a boolean value into an execute SQL Task in my SSIS package

  • Hi,

    I need help getting a boolean value into an execute SQL Task in my SSIS package.

    Will the value of 0 and 1 be interpreted as false and true in an SSIS single row result set with an SSIS boolean variable?

    So far no luck. I am going to change the below code to select instead of set so it returns something but as a whole,

    am I on the right track in my approach?

    Declare @ReturnValue tinyint

    IF EXISTS(SELECT ParameterValues FROM tbljobcontroller WHERE JobName = 'CMS_Import_EDW' AND ParameterValues Like '%5407%')

    BEGIN

    set @ReturnValue = 1

    --print 'return value 5407 found ' + cast(@ReturnValue as char(1))

    END

    ELSE

    BEGIN

    set @ReturnValue = 0

    --print 'return value NOT found 5407 ' + cast(@ReturnValue as char(1))

    END

    Thanks in advance

  • You can try the following:

    -----> CONVERT(BIT,1) for True

    -----> CONVERT(BIT,0) for False

    This will return a boolean value instead of a tinyint.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Convert(bit,colname) --- colanme will return true or false indeed helped. In my case i was trying to assign a false value from varchar column in my table to a boolean value and ran into the same error above.Thanks a lot:-)

  • No problem, glad to help.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

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

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