2Im in a big trouble, im refactoring a very big procedure to full text search, and I found a very important outer apply:
select top 1 *
from tablea
where
column1 like
case
when @value = 1 or @value = 2 then '%' + @something + '%'
else '%'
end
The logic here is: if @value is 1 or 2, get the first register with @something inside. Else, get any register.
What I need now is:
select top 1 *
from tablea
where
case
when @value = 1 or @value = 2 then contains(column1, @something)
else 1 = 1
end
The code above dont work, its mal formed, and I have no clue how solve that.