Precision/Scale question

  • I have a text file I import. The vendor has added some additional fields that I must now include as part of my import.

    Problem is that they give me a guide to use, but they didn't include scale or precision for decimal fields. So some my decimal fields are cutting off the decimals.

    Couldn't I just use a variant or varchar datatype here to capture all the vaules being sent?

  • You could use float, but I wouldn't recommend that. If you use an insane high precision/scale (like DECIMAL(37,12)), it shouldn't give you problems?

    Ronald HensbergenHelp us, help yourself... Post data so we can read and use it: http://www.sqlservercentral.com/articles/Best+Practices/61537/-------------------------------------------------------------------------2+2=5 for significant large values of 2

  • thanks for answering

    so if I use a high precision/scale (like DECIMAL(37,12))

    Will it then stop cutting off the numbers shown below?

    The numbers I'm importing look like:

    1997841.98000

    752000.00000

    3798077

  • DECIMAL(37,12) will have a precision of 37 digits, of which 12 are decimal.

    So 10,000,000,000,000,000,000,000,000.000000000001 will be accepted and not truncated (and also negatives). If you need a column for my bank account, you may use another data type (for the negative amounts...) 😉

    I use DECIMAL(25,12) a lot, which is quite exceptional already.

    Check out this link for more help: http://msdn.microsoft.com/en-us/library/ms187746.aspx

    Ronald HensbergenHelp us, help yourself... Post data so we can read and use it: http://www.sqlservercentral.com/articles/Best+Practices/61537/-------------------------------------------------------------------------2+2=5 for significant large values of 2

  • lol..I'll go ahead and make a deposit to your account.

    thanks man!

Viewing 5 posts - 1 through 4 (of 4 total)

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