Solved

T-SQL – Real of Decimal datatype?

Posted on 2014-11-09
6
127 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 500 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

     When we have to pass multiple rows of data to SQL Server, the developers either have to send one row at a time or come up with other workarounds to meet requirements like using XML to pass data, which is complex and tedious to use. There is a …
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

626 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