Reputation: 119
I'm expanding on a similar question titled Is SQL Server 'MONEY' data type a decimal floating point or binary floating point?
The accepted answer told us that the "money" datatype is fixed-point rather than floating-point type, but didn't say whether it was binary-fixed-point or decimal-fixed-point.
I'm assuming it's decimal-fixed-point but I can't find confirmation of this anywhere.
The documentation tells us the range and size, but not the underlying implementation.
Upvotes: 0
Views: 234
Reputation: 46203
Not sure why you care about the underlying implementation but you can CAST
a money
data type value to binary(8)
to see the value's bits:
DECLARE @money money;;
--same as min 64-bit signed integer (2's compliment) with 4 decimal places assumed
SET @money = -922337203685477.5808;
SELECT CAST(@money AS binary(8)); --0x8000000000000000
--same as max 64-bit signed integer with 4 decimal places assumed
SET @money = 922337203685477.5807
SELECT CAST(@money AS binary(8)); --0x7FFFFFFFFFFFFFFF
So money looks to be a 64 bit signed integer with 4 decimal places assumed. The precision/scale is not included with the value with money
(and it's smallmoney
cousin).
Upvotes: 3