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

Announcements

News and Announcements icon
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
    397 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
    397 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
    397 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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

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

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 635 Super User 2026 Season 1

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 595 Super User 2026 Season 1

#3
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 557

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans