Does anyone know if Sybase (12.5.3) supports the use of case
statements in the where clause. I have found many examples
of case statements used in the where clause in T-SQL on the
internet however I don't know whether these are Sybase T-SQL
or SQL Server T-SQL. I cannot get my stored procedure to
compile with a case statement in the where clause. I am
attempting to use a case statement to decide whether the
where clause should include an additional filtering
statement. My case statement is in the form:
declare @filterOnDOB int
declare @DOBfilterDate datetime
select @filterOnDOB = 1
select @DOBfilterDate = '01-01-1980'
Select name
From person
where person.id = 123
and case
when @filterOnDOB = 1 then person.DOB >
@DOBfilterDate
else 1=1
end
Therefor if @filterOnDOB is 1 and person 123 is born after
01-01-1980 I should retrieve person 123's record. If
@filterOnDOB is 0 I should get a person 123's record
regardless on their DOB.