kdeutsch
asked on
Check for zero and show 2 deciamls in t-sql
I am selcting a field that shows the number of months. So I am dividing by 12 to get the years, but I get a decimal string that I want to consolidate. So i tried CAST and Round but got whole numbers. Then I also have problem of dividing by zero. So how can i check for zero and show only like example below.
For example If Ithe field has 91 months it comes out as
7.583333333333
I would like it to be 7.58
Select Cast(sidstrNBR_MO_ACT_FED_ SVC /12 as float) from tblsidpers
For example If Ithe field has 91 months it comes out as
7.583333333333
I would like it to be 7.58
Select Cast(sidstrNBR_MO_ACT_FED_
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Wow answers a minute apart. Thanks for the quick help.
ASKER
Works Great
Select Cast(sidstrNBR_MO_ACT_FED_
If it is [tiny][small][big]int...
Select Cast(sidstrNBR_MO_ACT_FED_