web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Using INT Value in Math - SQL

(0) ShareShare
ReportReport
Posted on by 12

Ok, someone out there knows how to do this - I just can not find the right combination of SQL to make it work.

Field : PUnits - int 

Values: 6000, 5000, 900, 50

What I know is to do the math to get from PUnits * PRate = PLineTotal

need to divide Punits by 100 to get to the right decimal value

SO

6000 = 60.00
5000 = 50.00
  900 =   9.00
    50 =   0.00

(PRate *(PUnits/100)) -- all work when the value in PUnits has 3 or more characters - 

but when the PUnits value = 50 and I apply the same rule then the value ( PUnits/100 )  50 / 100 = 0000

I am sure that it is a matter of figuring out the right way to 'format' PUnits first.

Thanks.

Categories:
I have the same question (0)
  • Verified answer
    James McCullough Profile Picture
    379 on at

    This is the way I just did it:

    SELECT CONVERT(DECIMAL, 50) / CONVERT(DECIMAL, 100.00)

    I mean, it's heavy handed, but it will do it.  The problem is that SQL thinks that 50 and 100 are integers, and so is enforcing integer math on it.

  • Bill Campbell Profile Picture
    12 on at

    Thanks that got me the desired result.

  • James McCullough Profile Picture
    379 on at

    Hey Bill:

    Could you hit it as a "verified answer" then please?  I appreciate it greatly, as I'm just effectively getting started here.  :)

  • James McCullough Profile Picture
    379 on at

    And HEY!  You're a fellow Albertan!  I'm in Calgary!  :D

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 551 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 450 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 278 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans