• I tried this

    select * from IndustryMap

    WHERE 1 =1

    AND id_cusip = COALESCE(@cusip,id_cusip)

    AND ticker = COALESCE(@ticker,ticker)

    AND exch_code = COALESCE(@exchangeCode,exch_code)

    and was ready to scream Hurray but realized that

    when any of the columns have a null value

    this won't work. Because "AND col = NULL" is not valid.

    Keep searching.... 🙂