Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there any function corresponds to DECODE in Oracle ?
Message
From
28/10/1999 08:39:08
 
 
To
27/10/1999 23:04:25
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00282059
Message ID:
00282938
Views:
28
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform