Hey there,
Here is what I think you want to do.
When there is
.0
in
count_days
in this line
CASE WHEN count_days IS NULL THEN 0 ELSE count_days END AS count_days
then you want to remove
.0
from it.
Try replacing this line:
CASE WHEN count_days IS NULL THEN 0 ELSE count_days END AS count_days
with this one:
CASE WHEN count_days IS NULL THEN 0 ELSE
CASE WHEN CharIndex( '.0',cast(count_days as varchar)) > 0 THEN SUBSTRING(cast(count_days as varchar), 0, CharIndex( '.0',cast(count_days as varchar))) ELSE cast(count_days as varchar) END
END AS count_days
if it gives a conversion error then try the
0
in this part of
CASE
CASE WHEN count_days IS NULL THEN 0 ELSE
as
'0'
I really hope it works.
Do let me know, if this is not what you were looking for.
Good luck.
Azee...