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:
  • James McCullough Profile Picture
    356 on at
    RE: Using INT Value in Math - SQL

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

  • James McCullough Profile Picture
    356 on at
    RE: Using INT Value in Math - SQL

    Hey Bill:

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

  • Bill Campbell Profile Picture
    12 on at
    RE: Using INT Value in Math - SQL

    Thanks that got me the desired result.

  • Verified answer
    James McCullough Profile Picture
    356 on at
    RE: Using INT Value in Math - SQL

    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.

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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

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

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 565

#2
Martin Dráb Profile Picture

Martin Dráb 536 Most Valuable Professional

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 402 Super User 2025 Season 1

Product updates

Dynamics 365 release plans