SQL Function required - Choose()

  • Thread starter Thread starter Terry
  • Start date Start date
T

Terry

Is there a SQL Server equivalent to the Microsoft Access function
Choose ( position, value1, value2, ... value_n ) ? Or is it achieved by
onother method?
Regards
 
The Case statement offer a similar - but not identical - functionality.
There are two forms of it:

Select
Case Field1 When 1 then 'One' When 2 then 'Two' Else 'Don''t know' End as
No1,
Case When Field1 = 1 then 'One' When Field1 = 2 then 'Two' Else 'Don''t know
either' End as No2,
....

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain aei ca (fill the blanks, no spam please)
Independent consultant and remote programming for Access and SQL-Server
(French)
 
Hi Sylvain,
Thanks for the info. I guess the second example will do the trick.
Regards
Terry
 
Back
Top