I think your best option is ......where (column1 = @column1 and @column1 is not null)...
I know its a minor distinction, but if you run the following code and look at the execution plans, I think you'll see the major index advantages of the 'and' instead of the 'or'....use pubsdeclare @lname varchar(15)select @lname = 'afonso'select * from employeewhere lname = isnull(@lname,lname)select * from employeewhere (lname = @lname or @lname is null)select * from employeewhere case when @lname is null then 1 when @lname = lname then 1 else 0 end = 1select * from employeewhere (lname = @lname and @lname is not null)select @lname = nullselect * from employeewhere lname = isnull(@lname,lname)select * from employeewhere (lname = @lname or @lname is null)select * from employeewhere case when @lname is null then 1 when @lname = lname then 1 else 0 end = 1select * from employeewhere (lname = @lname and @lname is not null)
<O>Edited by - Page47 on 06/26/2002 08:46:24