Wednesday 30 November 2016

SMALLMONEY VS MONEY

What are the differences between SMALLMONEY and MONEY [SMALLMONEY VS MONEY]?
Which data type should use for defining a column in a table [SMALLMONEY VS MONEY]?


SMALLMONEY
MONEY
Bytes
4 bytes
8 bytes
Minimum Value
- 214,748.3648
-922,337,203,685,477.5808
Maximum Value
 214,748.3647
 922,337,203,685,477.5807
Max Length


Format
SMALLMONEY - Round of 2 digit


MONEY – Round of 2 digit
Example
DECLARE @smallmoney SMALLMONEY = 210000.36125
PRINT @smallmoney

OUTPUT: 210000.36

DECLARE @smallmoney SMALLMONEY = $210000.36125
PRINT @smallmoney

OUTPUT: 210000.36

210000 – Unit
. – Decimal point
36 - Mantissa
DECLARE @money MONEY = 2102333434000.365251232
PRINT @money

OUTPUT: 2102333434000.37


DECLARE @money MONEY = $2102333434000.365251232
PRINT @money


OUTPUT: 2102333434000.37



No comments:

Post a Comment