Tupacmoche
Registered User.
- Local time
- Yesterday, 22:16
- Joined
- Apr 28, 2008
- Messages
- 291
Hi All,
I have the weirdest error on a CASE statement but not really the CASE statement. I have added an additional condition to a CASE statement and then aliased column don't work. I could use a second pair of eyes The lines number where the issue is starts at 72 and ends at 80. The CASE statement on line 80 works fine but the lines starting at line 72 fail. Here is the code:
Works:
casewhenCAST(l.PREMIUM ASDECIMAL(12,2))<1 then' 'else'N'end PREMIUM_DECLINED_IND,
Does not work:
CASE
WHEN (AP.APPEAL_CODE ='HCX17F1W01XXXX')THENCASE
WHENCAST(l.PREMIUM ASDECIMAL(12,2))BETWEEN 35.00 AND 52.99 THEN' '
WHENCAST(l.PREMIUM ASDECIMAL(12,2))> 52.99 THEN' '
ELSE' 'ENDAS PREMIUM_DECLINED_IND,
Here are the errors:
Msg 156, Level 15, State 1, Line 77
Incorrect syntax near the keyword 'AS'.
Msg 102, Level 15, State 1, Line 80
Incorrect syntax near 'PREMIUM_DECLINED_IND'.
Msg 102, Level 15, State 1, Line 83
Incorrect syntax near 'PREMIUM_CODE'.
Msg 102, Level 15, State 1, Line 99
Incorrect syntax near 'a'.
Msg 102, Level 15, State 1, Line 100
Incorrect syntax near 'ap'.
Any help would be appreciated!:banghead:
I have the weirdest error on a CASE statement but not really the CASE statement. I have added an additional condition to a CASE statement and then aliased column don't work. I could use a second pair of eyes The lines number where the issue is starts at 72 and ends at 80. The CASE statement on line 80 works fine but the lines starting at line 72 fail. Here is the code:
Works:
casewhenCAST(l.PREMIUM ASDECIMAL(12,2))<1 then' 'else'N'end PREMIUM_DECLINED_IND,
Does not work:
CASE
WHEN (AP.APPEAL_CODE ='HCX17F1W01XXXX')THENCASE
WHENCAST(l.PREMIUM ASDECIMAL(12,2))BETWEEN 35.00 AND 52.99 THEN' '
WHENCAST(l.PREMIUM ASDECIMAL(12,2))> 52.99 THEN' '
ELSE' 'ENDAS PREMIUM_DECLINED_IND,
Here are the errors:
Msg 156, Level 15, State 1, Line 77
Incorrect syntax near the keyword 'AS'.
Msg 102, Level 15, State 1, Line 80
Incorrect syntax near 'PREMIUM_DECLINED_IND'.
Msg 102, Level 15, State 1, Line 83
Incorrect syntax near 'PREMIUM_CODE'.
Msg 102, Level 15, State 1, Line 99
Incorrect syntax near 'a'.
Msg 102, Level 15, State 1, Line 100
Incorrect syntax near 'ap'.
Any help would be appreciated!:banghead: