Not sure, but think that this is done to preserve the value where digit loss can be a significant data change specially in case of some critical measurement or money.
Also, interesting thing to lookout for is this behavior
SELECT CAST(1001 as VARCHAR(3)) -- produces *
SELECT CAST(1001 as NVARCHAR(3)) -- Arithmetic overflow exception of level 16
Think that this inconsistency exists due to the different timeframe when datatype added to SQL Server, but not really sure. Will be glad to know if there is another reason for this behavior.
Thanks for this nice puzzle where I leaned something new today.
commented on Dec 1 2014 12:43AM