[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

numeric vs number

Posted on 2009-02-12
6
Medium Priority
?
1,035 Views
Last Modified: 2012-06-27
When building a table in MSSQL 2005 that an Oracle database the data types of course are a bit different.  Take for example and simple number data type "number(12)"  When I create the colume in MSSQL I have numeric as a choice.  But it automaticly sets up the precision and scale as numeric(12,0).  Should I use a different data type?
0
Comment
Question by:edrosie
6 Comments
 
LVL 25

Expert Comment

by:reb73
ID: 23624799
Int, Float and Money would be preferable..
0
 
LVL 93

Expert Comment

by:Patrick Matthews
ID: 23624808
In SQL Server, precision indicates how many significant digits can be stored, and scale how many of
those significant digits are reserved for the decimal portion.

It all comes down to:
1) How large are your (absolute) values going to get? and
2) How many decimal places do you have to retain?
0
 

Author Comment

by:edrosie
ID: 23624852
Why would the mapping numeric(12) to float be preferable?
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 25

Expert Comment

by:reb73
ID: 23624935
float is more of a basic data type and the underlying implementation of this datatype is easier for the SQL Engine to handle..
0
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 200 total points
ID: 23625314
>>Why would the mapping numeric(12) to float be preferable?<<
IMBO opinion float should never be used unless you are involved with lunar landings and need astronomical numbers.  Float has the IEEE 754 format and is an approximate data type as opposed to numeric which is a fixed value.  So if you do not mind getting a value of 1234.560000000000001 instead of 1234.56 use float.  Incidentally, the same appies to real.  If you have ever used double or single in VB6 you will understand how flawed those data types are, again the reason is the same IEEE format.

But back to your question.  To me your choices are quite clear: If you do not need decimals than use integer or bigint.  If you do need decimals or bigint is not big enough then use numeric.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 23625327
And I really need to get my acronyms right.  It is of course:
IMHO float should never be used ....
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

872 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