Solved

How to change several decimal digits into 2

Posted on 2008-10-01
5
180 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
  • 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I've encountered valid database schemas that do not have a primary key.  For example, I use LogParser from Microsoft to push IIS logs into a SQL database table for processing and analysis.  However, occasionally due to user error or a scheduled task…
INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
This video discusses moving either the default database or any database to a new volume.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

758 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now