How to convert a char into a bit??

  • This doesn't work.

    declare

    @checked char(1)

    select

    @checked = 'y'

    select

    convert(bit, @checked) as 'checked'

    Mant thanks for any help.

    Al

  • SELECT

    CASE WHEN @checked IN ('Y', 'True', '1', 'yes') THEN 1 ELSE 0 END

    -Eddie

    Eddie Wuerch
    MCM: SQL

  • Are you saying that a domain of {0,1} or {'T','F'}, or whatever, in the logical model should never be mapped to the semantic values true, false in the conceptual model ?

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

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

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