Whats wrong in my SQL

  • Whats wrong in my SQL  ?

    When I try to use in Cause with 2 colomn value its giving me error 170. Is this means I can have 2 columns in my In caluse or what ?. Any help.

     

    select case txttypebus

    WHEN 'Renewal' THEN numpolicy + numedition

    WHEN 'New Business' THEN numsubmission + numquote

    END,

    Txttypebus, numpolicy, numsubmission

    FROM tblsublog

    WHERE cde_undterr = '02'

    And txttypebus = 'New Business'

    and (numsubmission,numquote) in (

    select a00_snum, A06_QNUM

    from cmsi_prod ..CMSI.SCOMMON

    WHERE A0R_UW_Territory = '02')

    select case txttypebus

    WHEN 'Renewal' THEN numpolicy + numedition

    WHEN 'New Business' THEN numsubmission + numquote

    END,

    Txttypebus, numpolicy, numsubmission

    FROM tblsublog

    WHERE cde_undterr = '02'

    And txttypebus = 'New Business'

    and (numsubmission,numquote) in (

    select a00_snum, A06_QNUM

    from cmsi_prod ..CMSI.SCOMMON

    WHERE A0R_UW_Territory = '02')

  • The offending code is~:

    and (numsubmission,numquote) in (

    select a00_snum, A06_QNUM

    from cmsi_prod ..CMSI.SCOMMON

    WHERE A0R_UW_Territory = '02')

    You cannot use two values for an in clause in this method. Trying concatenating them:

    cast(numsubmission as nvarchar(255)) + cast(numquote as nvarchar(255))

    in(

    cast(a00_snum as nvarchar(255)) + cast(A06_QNUM  as nvarchar(255))

     


    ------------------------------
    The Users are always right - when I'm not wrong!

  • Thanks it worked

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

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