According to the following description I have to frame a CASE...END statement in SQL server , help me to frame a complex CASE...END statement to fulfill the following condition.
if PAT_ENT.SCR_DT is not null and PAT_ENTRY.ELIGIBILITY is null then display display 'Favor'
if PAT_ENT.SCR_DT is not null and PAT_ENTRY.EL is equal to No, display 'Error'
if PAT_ENTRY.EL is Yes and DS.DES is equal to null or OFF, display 'Active'
if DS.DES is equal to N, display 'Early Term'
if DS.DES is equal to Y, display 'Complete'
Thanks in advance.
You can put the condition after the
WHENclause, like so:Of course, the argument could be made that complex rules like this belong in your business logic layer, not in a stored procedure in the database…