Click here to Skip to main content
15,887,966 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi experts,

Here is my sql querry
SQL
declare @lastPensionMonth varchar(50)
Select top 1 @lastPensionMonth = case  when BMT_MONTH= '1' then 'jan'
                                       when BMT_MONTH= '2' then 'feb'
                                       when BMT_MONTH= '3' then 'mar'
                                       when BMT_MONTH= '4' then 'apr'
                                       when BMT_MONTH= '5' then 'may'
                                       when BMT_MONTH= '6' then 'jun'
                                       when BMT_MONTH= '7' then 'jul'
                                       when BMT_MONTH= '8' then 'aug'
                                       when BMT_MONTH= '9' then 'spt'
                                       when BMT_MONTH= '10' then 'oct'
                                       when BMT_MONTH= '11' then 'nov'
                                       when BMT_MONTH= '12' then 'dec'
                                                else
                                       'Not started to take pension'
                                                end
                                                from Beneficiary_Monthly_Pension_Tran where BMT_Beneficiary_ID='000002316'
                                                order by bmt_year desc
                                                select @lastPensionMonth


It is not returning the else condition string for the true part it is working properly
false part it is returning null value. Can Any one please tell me the mistake.

Thanks in advance
(Keerthi Kumar)
Posted
Updated 21-Mar-14 20:07pm
v3

Remove
VB
else
        "Not started to take pension"

add
SQL
declare @lastPensionMonth varchar(50)
SET @lastPensionMonth='Not started to take pension'
 
Share this answer
 
Comments
Keerthi Kumar(Andar) 22-Mar-14 2:22am    
hi Peter Leow,
Its working fine.
Thanks a lot for your guidance.

Thanking You
(Keerthi Kumar)
Peter Leow 22-Mar-14 2:31am    
You are welcome.
King Fisher 22-Mar-14 2:25am    
sorry i didn't see your answer.i was opened it before you,but i'm little bit slow
My 5 for nice catch.

:)
Peter Leow 22-Mar-14 2:33am    
Thank you.
yes the issue is  "Not started to take pension"


use 'Not started to take pension'
 
Share this answer
 
Comments
Peter Leow 22-Mar-14 2:34am    
Any effort is commendable, keep going, +5!
King Fisher 22-Mar-14 2:41am    
thank you so much. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900