Home Forums Programming General Convert IIF to Case Statements and Instr to charindex or Like RE: Convert IIF to Case Statements and Instr to charindex or Like

  • found my error, this works. Thanks! higgim, your code gave me the structure I needed for my query below.

    ;With ClientDomains_CTE3

    AS

    (

    SELECT ClientDomains.DomainType

    , ClientDomains.ClientVndNbr

    , ClientDomains.ClientVndName

    , RTRIM(REPLACE(

    REPLACE(

    REPLACE(

    REPLACE(ClientVndName, ' CO ', ' ')

    ,' INC ', ' ')

    ,' INC.', ' ')

    ,' LTD ', ' ')

    ) as ShortName

    FROM ClientDomains

    WHERE ClientDomains.DomainType = 'CltDom'

    AND (ClientVndName LIKE '% INC %' OR ClientVndName LIKE '% CO %' OR ClientVndName LIKE '% INC.%' OR ClientVndName LIKE '% LTD %')

    AND (ClientDomains.CorpVndNbr = 0 OR ClientDomains.CorpVndNbr IS NULL)

    )

    Select * From ClientDomains_CTE3