## 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
Solved

# How can I get the mantissa (integer) portion of a decimal in sql

Posted on 2013-11-25
1,043 Views
If I have decimal 123456789.456789

How can I get the 123456789 portion of it.
0
Question by:countrymeister

LVL 65

Expert Comment

ID: 39675576
Just cast it as an integer..
``````SELECT CAST(123456789.456789 as int)
``````
0

LVL 10

Expert Comment

ID: 39675600
or use the TQSL round:  select round(123456789.456789,0) as result
0

LVL 5

Expert Comment

ID: 39675628
Or if you don't want it to round and just want to drop it use this version ofTSQL Round:

SELECT ROUND(123456789.456789, 0, 1) as RoundWithZero
0

LVL 10

Expert Comment

ID: 39675659
Thanks for filling that in, Ivbarnes.  Missed it :)
0

LVL 69

Accepted Solution

Scott Pletcher earned 300 total points
ID: 39675827
If you want to truncate, so that 12.99999 became 12, you could also do:

FLOOR(decimal_column)

If you always wanted to round up, so that 12.05 became 13, you could do:

CEILING(decimal_column)
0

LVL 5

Expert Comment

ID: 39675843
Huzzah Scott!
0

## Featured Post

Question has a verified solution.

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