Posted on: 4/2/2013 7:12:57 PM | Views : 276

Hi,
I have a very long query and so many where statements. If I don't have any value then I would like to ignore that where statement.
Can someone write a small query for me if parameter value is null then that where statement ignores?
where (tm.firstname like '%' + @firstname + '%' or tm.firstname is null) and (tm.lastname like '%' + @lastname + '%' or tm.lastname is null)
I am doing this but I know it's not going to work because what i want to do is if @firstname is null then it will ignore where statement and go for the antoher one.

Thanks.
...

Go to the complete details ...