I need to write a conditional statement in my where clause that uses different operators based on the parameter passed into the procedure. I can't seem to find the syntax that will work.
My example is as follows:
@DateValue datetime
select *
from table
where field1 = 'x'
and field2 = 'y'
and if @DateValue = '1/1/1900' then
field3 <= getdate()
else
field3 = @DateValue
end
Thanks for everyone's assistance.