• Hi, I think

    ColumnOne = insnull(@pSearchArg, ColumnOne)

    whill not work, because null value in ColumnOne will fail this expression.

    I'd like to use something like the following if you insist on using "like":

    CREATE PROCEDURE sp_MySearch

    @p1 varchar(50),

    @p2 varchar(50),

    AS

    select * from t where

    isnull(c1, '') like case when len(isnull(@p1,'')) =0 then isnull(c1, '') else '%'+@p1+'%' end and

    isnull(c2, '') like case when len(isnull(@p2,'')) =0 then isnull(c2, '') else '%'+@p2+'%' end

    Of cause the performance using "like" is far poor than using a "="