Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Iif
Message
 
 
À
17/11/2003 07:01:19
Philip Jones
Cornwall County Council
Truro, Royaume Uni
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Re: Iif
Divers
Thread ID:
00850582
Message ID:
00850597
Vues:
13
>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--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform