We help IT Professionals succeed at work.

Check out this week's podcast, "Dairy Farms to Databases: Community's Hand in Technology"Listen Now

x

T-SQL – Real of Decimal datatype?

dvplayltd
dvplayltd asked
on
183 Views
Last Modified: 2014-11-10
Dear experts,

I have an SQL 2008R2 database with a filed in it which is now Money datatype. But it look I’ll need to store more than 4 digits and as you know it is limit to for example 0.2345, but now I should be able to write a value like 0.234567 (up to 10 digit depends of customer precision selected).

So my question is – what data type I should select in SQL ? Decimal or real or float? This table is expected to have milions of records in few years and will be heavy used.

This amount will be used for :
1) A lot of Sum over it
 2)Delete other Money value to this value and then and then multiple by this value – 10 times rather than 1)

I think for now to use Decimal – like (12,9)
Comment
Watch Question

SQL Server Data Dude
CERTIFIED EXPERT
Most Valuable Expert 2013
Author of the Year 2015
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
To Jim,

Thanks for your time. The value may be 99.23456 that is why 12,9.

So you tell me to use numeric(12,9) instead decimal(12,9) ? This is different types ?
Jim HornSQL Server Data Dude
CERTIFIED EXPERT
Most Valuable Expert 2013
Author of the Year 2015

Commented:
Functionally they're the same animal.  Not sure why they both exist though, my guess would be backwards compatibility.
Peter ChanProblem resolver

Commented:
Hi,
You can have more decimal precision by using the data type like
decimal(23,7)

Author

Commented:
10x
Jim HornSQL Server Data Dude
CERTIFIED EXPERT
Most Valuable Expert 2013
Author of the Year 2015

Commented:
Thanks for the grade.  Good luck with your project.  -Jim
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.