Use Log10 : Log10 « Math Functions « SQL Server / T-SQL






Use Log10


12>
13> SET NOCOUNT ON
14> DECLARE @float1 float
15> SET @float1 = CAST(POWER(10,9) as float)
16> SELECT @float1 * @float1 * @float1 * @float1 * 100 AS 'Large Float value',
17>     FLOOR(LOG10(@float1 * @float1 * @float1 * @float1 * 100)
18>     + 1) AS 'Number of digits'
19> GO
Large Float value        Number of digits
------------------------ ------------------------
  9.9999999999999998E+37                       39
1>
2>
           
       








Related examples in the same category

1.LOG10: returns the base 10 logarithm of this parameter as a float value