What database data type do I need to use to store a numerical value with 18 digits after the decimal place? I've tried double and float but it doesn't work it only shows 16 digits after the decimal place. I'm using MS SQL Server 2005 and 2008.
1 Answer
Assuming your values are not too big, you want to use DECIMAL. Something like DECIMAL(20, 18) (adjust the first value for the total number of digits in the number).
You can read about it here.
2 Comments
user1302054
What if the total number of digits vary?
Gordon Linoff
@user1302054 . . . Just use a large enough value for the first digit . . .
DECIMAL(30, 18) should be big and precise enough for most measurements.