Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is there any function corresponds to DECODE in Oracle ?
Message
De
28/10/1999 08:39:08
 
 
À
27/10/1999 23:04:25
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00282059
Message ID:
00282938
Vues:
27
You can use the ANSI CASE expression and generate the same results


SELECT emp_id, emp_name,
CASE sex
WHEN 'M' THEN 'Male'
WHEN 'F' THEN 'Female'
ELSE 'Problem'
END
FROM emp

The CASE actually has two forms. The first is called Simple case. It's the form that I used above. The second is called Searched case. Check the BOL for more info.

>emp_id emp_name sex
>------ -------- ---
>001 John M
>002 Susie F
>003 David M
>004 Dummy null
>
>Using decode
>
>Select emp_id , emp_name , DECODE(sex,'M','Male','F','Female','Male') SEX
>From emp
>

-Mike
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform