translate oracle 'decode' to sqlserver 'case'

dj59

Registered User.
Local time
Today, 09:45
Joined
Jul 27, 2012
Messages
70
I am trying to translate plsql (oracle) to sql for access (sql server).
This is the plsql line of code:
Code:
decode(alleg_determ_ind, 'Y', 'Y') as md

The follwing are things I've tried, but none of them work:
Code:
Select.....
CASE alleg_determ_ind WHEN 'Y' THEN 'Y' ELSE 'N' END md
 
CASE alleg_determ_ind WHEN 'Y' THEN 'Y' ELSE 'N' END AS md

CASE (alleg_determ_ind WHEN 'Y' THEN 'Y') ELSE 'N' END md
 
SWITCH(alleg_determ_ind WHEN 'Y' THEN 'Y' ELSE 'N' END
from......

I'm doing this in Access if that makes any difference.
Thanks for any help.
 
If you're doing it in Access then CASE won't work. IIf() and Switch() are options. Not familiar with Decode, so you might describe in words what you want to happen, and clarify what platform you're working in. Either of the first 2 look fine in SQL Server.
 
Thank You....The following works for me!

Code:
switch(alleg_determ_ind = 'Y', 'Y') AS md
 
Glad you got it sorted.
 

Users who are viewing this thread

Back
Top Bottom