Friday, August 29, 2014

Adding a Dollar $ to calculation from a CASE statement

You must convert your value to a char data type.


HOWEVER, you should be doing this in your presentation layer, not in your query.



'$' + CONVERT(VARCHAR,case
when (tblbookin.bookindt between '2013-10-01 00:00:00.000' AND '2014-09-30 23:59:59.999')
then ((DATEDIFF(DAY,tblbookin.bookindt,tblrelease.releaseddt)) * 62.46)
when (tblbookin.bookindt between '2014-10-01 00:00:00.000' AND '2015-09-30 23:59:59.999')
then ((DATEDIFF(DAY,tblbookin.bookindt,tblrelease.releaseddt)) * 63.11)
end)


No comments:

Post a Comment