Use select to do the calculation
12> SET NOCOUNT ON
13> DECLARE @dec1 decimal(38,0)
14> SET @dec1 = CAST(POWER(10,9) as decimal(38,0))
15> SELECT @dec1 * @dec1 * @dec1 * @dec1 * 10 AS 'Large Decimal value',
16> FLOOR(LOG10(@dec1 * @dec1 * @dec1 * @dec1 * 10)
17> + 1) AS 'Number of digits'
18> GO
Large Decimal value Number of digits
---------------------------------------- ------------------------
10000000000000000000000000000000000000 38
1>
2>
Related examples in the same category