In Oracle we have expression
SELECT
....
DECODE (T.LANGUAGE, 'E', T.DESC_ENG, T.DESC)
FROM
TABLE T
if acts like that :
if T.LANGUAGE = 'E' it returns T.DESC_ENG. If it is different - T.DESC.
Is there some way to make the same in MS SQL Server ?Use a CASE statement.
blindman|||why not just give it to him/her...
SELECT CASE WHEN T.LANGUAGE = 'E' THEN T.DESC_ENG ELSE T.DESC END
DECODE is such a pain in the neck...
I swear Oracle 8i...for as powerful as it is, has NOTHING close to Case...|||Really? I've heard Oracle people (should we call them "Sibyl"s?) complain many times that SQL Server does not have a DECODE equivalent, but I didn't know that Oracl doesn't have a CASE equivalent. That does seem to be a major shortcoming.|||Originally posted by blindman
Really? I've heard Oracle people (should we call them "Sibyl"s?) complain many times that SQL Server does not have a DECODE equivalent, but I didn't know that Oracl doesn't have a CASE equivalent. That does seem to be a major shortcoming.
I don't know about > 8i...but there is no CASE
Complain that SQL doesn't have DECODE?
Looks like 9i has come up to snuff in a lot of areas...
http://www.praetoriate.com/oracle_tips_case_statement.htm|||COALESCE is somewhat similar to DECODE.|||you can also write your own function to emmulate decode|||Originally posted by rdjabarov
COALESCE is somewhat similar to DECODE.
Similar...barely though...as long as you're limited to NULL
you can also write your own function to emmulate decode
Really? I was going to give it a shot...but I realized it's not worth it...giving the fact that we already have CASE (which 9i now has).
You have to have the ability to evaluate ANY expression...I think (and now mind you, only on rare occasions) it would be a big job...
No comments:
Post a Comment