Solved

How to change several decimal digits into 2

Posted on 2008-10-01
5
185 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 500 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

623 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