Sybase Question:
Download Questions PDF

How to implement if-then-else in a select clause in Sybase?

Answer:

declare @val char(20)
select @val = 'grand'

select case when @val = 'small' then
'petit'
else
'grand'
end


However, quite a number of people are still using pre-11.5 implementations, including those people using the free 11.0.3.3 Linux release. In that case you can use the following recipe.

To implement the following condition in a select clause:

if @val = 'small' then
print 'petit'
else
print 'grand'
fi

Download Sybase Interview Questions And Answers PDF

Previous QuestionNext Question
Fixing a Munged Log in Sybase?How do I remove duplicate rows from a table in Sybase?