Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to change several decimal digits into 2

Posted on 2008-10-01
5
Medium Priority
?
187 Views
Last Modified: 2012-05-05
I am using this function, it is working but i am getting several decimal digits, any way i can change it two

case when e.interestrate = 0 then 0 else abs(l.fin_chrg/(e.interestrate/12)) end as AAVGBALA

result
13.8030303030303

0
Comment
Question by:fahVB
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 39

Expert Comment

by:BrandonGalderisi
ID: 22618748
cast(case when e.interestrate = 0 then 0 else abs(l.fin_chrg/(e.interestrate/12)) end ) as decimal(6,2)) as AAVGBALA
0
 
LVL 7

Expert Comment

by:aboredman
ID: 22618750
The easiest way is often to:

1. Multiply by 100
2. convert to integer (round to the nearest multiple of 1)
3. Convert to Decimal
4. Divide by 100.
0
 

Author Comment

by:fahVB
ID: 22618790
getting this error

Msg 1035, Level 15, State 10, Line 18
Incorrect syntax near 'cast', expected 'AS'.
0
 
LVL 39

Accepted Solution

by:
BrandonGalderisi earned 2000 total points
ID: 22619140
Sorry... one too many )


cast(case when e.interestrate = 0 then 0 else abs(l.fin_chrg/(e.interestrate/12)) end as decimal(6,2)) as AAVGBALA
0
 

Author Closing Comment

by:fahVB
ID: 31502158
Cool, thanks
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
by Mark Wills PIVOT is a great facility and solves many an EAV (Entity - Attribute - Value) type transformation where we need the information held as data within a column to become columns in their own right. Now, in some cases that is relatively…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

664 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question