Please don't put duplicate with question [IF clause within WHERE clause](https://stackoverflow.com/questions/87821/sql-if-clause-within-where-clause) ?
I think my question is difference, I have been tryed but I can't not run success with condition below. 

How can put if condition between where in sql 
for example

```
        SELECT *
        FROM LocationOutsw W
        WHERE if(@p_type = 'ALL') then
            (W.NAME LIKE '%'+ @p_search + '%' OR W.DESCRIPTION LIKE '%'+ @p_search + '%')
            if(@p_type == "NAME")
              W.NAME LIKE '%'+ @p_search + '%'
            if(@p_type == "DESCRIPTION ")
              W.DESCRIPTION LIKE '%'+ @p_search + '%')

```