?
Solved

T-SQL – Real of Decimal datatype?

Posted on 2014-11-09
6
Medium Priority
?
133 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)
0
Comment
Question by:dvplayltd
[X]
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
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 66

Accepted Solution

by:
Jim Horn earned 2000 total points
ID: 40431978
>I should be able to write a value like 0.234567 (up to 10 digit depends of customer precision selected).
numeric(11, 10) if we're talking only a single number left of the decimal, and up to 10 digits after.
The 11 can go as high as 38 total digits.

decimal and numeric are functionally the same

float and real are approximate data types, and I haven't had experience with this but it would scare most uses away from it.
0
 

Author Comment

by:dvplayltd
ID: 40431985
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 ?
0
 
LVL 66

Expert Comment

by:Jim Horn
ID: 40431989
Functionally they're the same animal.  Not sure why they both exist though, my guess would be backwards compatibility.
0
10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

 
LVL 11

Expert Comment

by:HuaMinChen
ID: 40432005
Hi,
You can have more decimal precision by using the data type like
decimal(23,7)
0
 

Author Closing Comment

by:dvplayltd
ID: 40432017
10x
0
 
LVL 66

Expert Comment

by:Jim Horn
ID: 40432636
Thanks for the grade.  Good luck with your project.  -Jim
0

Featured Post

How Blockchain Is Impacting Every Industry

Blockchain expert Alex Tapscott talks to Acronis VP Frank Jablonski about this revolutionary technology and how it's making inroads into other industries and facets of everyday life.

Question has a verified solution.

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

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question