DECLARE @x float -- 覲 , @mu float -- 蠏 , @sigma float -- 譴ク谿 SET @x = 0.35 SET @mu = 0 SET @sigma = 1; --SELECT (1/(SQRT(2*PI())*@sigma)) * EXP(-(1/(2*POWER(@sigma,2))) * POWER((@x-@mu), 2)) WITH Dumy(x) AS ( SELECT convert(float, 0) x UNION ALL SELECT x + 0.01 FROM Dumy WHERE x + 0.01 < 3.09 ) /* SELECT ROUND(A.x, 2) x , B.Pr Pr FROM Dumy A CROSS APPLY ( SELECT --蠍郁 譟磯 覦 覿 覿覿企. SUM((1/(SQRT(2*PI())*@sigma)) * EXP(-(1/(2*POWER(@sigma,2))) * POWER((x-@mu), 2))) / 100 Pr FROM Dumy B WHERE x < A.x ) B WHERE ROUND(A.x, 2) = @x OPTION (MAXRECURSION 0); */ SELECT LEFT(x, 3) z , MIN(CASE WHEN RIGHT(x, 1) = 0 THEN Pr END) [0.00] , MIN(CASE WHEN RIGHT(x, 1) = 1 THEN Pr END) [0.01] , MIN(CASE WHEN RIGHT(x, 1) = 2 THEN Pr END) [0.02] , MIN(CASE WHEN RIGHT(x, 1) = 3 THEN Pr END) [0.03] , MIN(CASE WHEN RIGHT(x, 1) = 4 THEN Pr END) [0.04] , MIN(CASE WHEN RIGHT(x, 1) = 5 THEN Pr END) [0.05] , MIN(CASE WHEN RIGHT(x, 1) = 6 THEN Pr END) [0.06] , MIN(CASE WHEN RIGHT(x, 1) = 7 THEN Pr END) [0.07] , MIN(CASE WHEN RIGHT(x, 1) = 8 THEN Pr END) [0.08] , MIN(CASE WHEN RIGHT(x, 1) = 9 THEN Pr END) [0.09] FROM ( SELECT CONVERT(char(4), CONVERT(numeric(36, 2), A.x)) x , CONVERT(numeric(36, 6), ISNULL(B.Pr, 0)) Pr FROM Dumy A CROSS APPLY ( SELECT SUM((1/(SQRT(2*PI())*@sigma)) * EXP(-(1/(2*POWER(@sigma,2))) * POWER((x-@mu), 2))) / 100 Pr FROM Dumy B WHERE x < A.x ) B ) T GROUP BY LEFT(x, 3) ORDER BY LEFT(x, 3) OPTION (MAXRECURSION 0);