Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Iif
Message
 
 
To
17/11/2003 07:01:19
Philip Jones
Cornwall County Council
Truro, United Kingdom
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Re: Iif
Miscellaneous
Thread ID:
00850582
Message ID:
00850597
Views:
15
>Hi,
>I'm trying to use iif within a select statement but U can't get anything to work.
>I have a field containing character values '0' or '1' an I want to return a different character string depending on the value.
>Can you use iif() within a select statement?

Sql Server doesn't have IIF() function but you can use more powerfull CASE function.
... CASE myfield
WHEN '0' Then 'Zero' 
WHEN '1' Then 'One' 
ELSE '???' END 
-- OR another form
CASE 
WHEN myfield = '0' Then 'Zero' 
WHEN myfield = '1' Then 'One' 
ELSE '???' END
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform