SQL Server/T-SQL/Math Functions/Power
POWER: returns the value of the first parameter raised to the power of the second parameter
2> -- POWER: returns the value of the first parameter raised to the power of the second parameter.
3>
4> SELECT POWER(3,2)
5> GO
-----------
9
(1 rows affected)
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>