Answers

Question and Answer:

  Home  Sybase

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

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

 141 views

More Questions for you: