October 30, 2008 at 9:35 am
Hello all,
How can I cast the 'N/A' in order to meet the field type requirements?
CASE
WHEN DATEDIFF(week,DMA.InceptDate,DMR.ReturnDate) < 52 THEN 'N/A'
ELSE
((POWER((CONVERT(DECIMAL(18,4),ISNULL(psr.itd_tot_return,0))/100)+1,
CONVERT(DECIMAL(18,4),52)/
DATEDIFF(week,DMA.InceptDate,DMR.ReturnDate)) - 1) * 100)
END AS AnnualizedReturn
Thanks,
DK
October 30, 2008 at 9:51 am
do you do any math on the AnnualizedReturn value after it is calculated here? If not you can just CAST this entire CASE expression as VARCHAR. If you do additional math, you'll probably need a separate column to signal your report or application that the result should be N/A instead of at the database level.
October 30, 2008 at 1:10 pm
Thanks Chris,
That worked, I did not have any additional calculations, so I cast each row and it worked.
Thanks,
DK
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply