data type

  • what data type should i define a col as for data that is 0.891?

  • You can use Float

  • You cal also use 'real'.

    float

    - 1.79E+308 to -2.23E-308, 0 and 2.23E-308 to 1.79E+308

    Depends on the value of n(Storage)

    real

    - 3.40E + 38 to -1.18E - 38, 0 and 1.18E - 38 to 3.40E + 38

    4 Bytes (Storage)

  • i thought float,real and numeric were non-deterministic so you get approximations like 3.99999999999999999994 for the value of 4.00 stored and such...., and it was better to use money or decimal datatypes, like decimal(6,4)?

    am i wrong?

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Decimal(x,y) is a better option.

    ******************
    Dinakar Nethi
    Life is short. Enjoy it.
    ******************

  • Yup,Decimal(x,y) is better

  • Lowell (10/29/2007)


    i thought float,real and numeric were non-deterministic so you get approximations like 3.99999999999999999994 for the value of 4.00 stored and such...., and it was better to use money or decimal datatypes, like decimal(6,4)?

    am i wrong?

    You're right. Decimal is the way to go here:

    DECIMAL(Total Digits, digits to the right of the decimal)

    or in this case:

    DECIMAL (5,4)

    ----------------------------------------------------The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood... Theodore RooseveltThe Scary DBAAuthor of: SQL Server 2017 Query Performance Tuning, 5th Edition and SQL Server Execution Plans, 3rd EditionProduct Evangelist for Red Gate Software

  • I think Decimal(x, y) would be a better option.

    Cheers!

    Sandy.

    --

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply