numeric vs number

Posted on 2009-02-12
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?
Question by:edrosie
    LVL 25

    Expert Comment

    Int, Float and Money would be preferable..
    LVL 92

    Expert Comment

    by:Patrick Matthews
    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?

    Author Comment

    Why would the mapping numeric(12) to float be preferable?
    LVL 25

    Expert Comment

    float is more of a basic data type and the underlying implementation of this datatype is easier for the SQL Engine to handle..
    LVL 75

    Accepted Solution

    >>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.
    LVL 75

    Expert Comment

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

    Featured Post

    Gigs: Get Your Project Delivered by an Expert

    Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

    Join & Write a Comment

    There are some very powerful Data Management Views (DMV's) introduced with SQL 2005. The two in particular that we are going to discuss are sys.dm_db_index_usage_stats and sys.dm_db_index_operational_stats.   Recently, I was involved in a discu…
    In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    746 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now