Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what data type should I use for storing small decimal value

Tags:

tsql

what data type should I use to store small decimal value? Ranging from -50.00 to 50.00?

Thanks,

like image 742
sean717 Avatar asked Jun 10 '10 18:06

sean717


2 Answers

Try DECIMAL(4,2) which would allow you to store -99.99 to 99.99

MSDN documentation for DECIMAL.
The 4 represents the precision which is the total number of digits that can be stored (to the left and right of the decimal place).
The 2 represents the scale which is the number of digits that can appear after the decimal place.

like image 107
AdaTheDev Avatar answered Jan 02 '23 20:01

AdaTheDev


Look at

http://msdn.microsoft.com/en-us/library/ms187746.aspx

Basically you need two points before the decimal and 2 after?

columnname precision(4)
like image 35
Bob Fincheimer Avatar answered Jan 02 '23 19:01

Bob Fincheimer