Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
divan
Posting Yak Master
153 Posts |
Posted - 2013-05-10 : 10:55:52
|
I have the following statement in my script CASE WHEN ERC2.TERMINATION_DATE IS NULL AND ERC.TAIL_PREM > 0 THEN 'I' ELSE ERC2.TERMINATION_DATE IS NOT NULL AND ERC.TAIL_PREM > 0 THEN 'C' ELSE ' 'END AS ERC_INSURED_STATUS_CODEand I get the following error messageServer: Msg 156, Level 15, State 1, Line 8Incorrect syntax near the keyword 'IS'.Server: Msg 156, Level 15, State 1, Line 14Incorrect syntax near the keyword 'WHERE'.this tell me the nested case is wrong.. Any idea how to go about fixing this.. |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-05-10 : 11:00:30
|
[code]CASE WHEN ERC2.TERMINATION_DATE IS NULL AND ERC.TAIL_PREM > 0 THEN 'I' WHEN ERC2.TERMINATION_DATE IS NOT NULL AND ERC.TAIL_PREM > 0 THEN 'C' ELSE ' 'END AS ERC_INSURED_STATUS_CODE[/code]If you are used to C#/Java, it's like a switch (that does not fall through). |
|
|
divan
Posting Yak Master
153 Posts |
Posted - 2013-05-10 : 11:04:41
|
Thanks James |
|
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-05-10 : 13:18:12
|
You are very welcome - glad to help. |
|
|
|
|
|