返回给定数字表达式的绝对值 ABS( numeric_expression ) selectabs(-1.0),abs(0.0),abs(1.0) go
2. DEGREES
当给出以弧度为单位的角度时,返回相应的以度数为单位的角度 DEGREES ( numeric_expression ) select'PI/2 is '+convert(varchar,degrees((pi()/2))) go
3. RAND
返回0到1之间的随机float值 RAND ( [ seed ] ) declare@countersmallint set@counter=1 while@counter<4 begin selectrand(@counter) 随机数 set nocount on set@counter=@counter+1 set nocount off end go
4.ACOS
返回以弧度表示的角度值,该角度值的余弦为给定的 float 表达式;本函数亦称反余弦 ACOS ( float_expression ) SET NOCOUNT OFF DECLARE@anglefloat SET@angle=-1 SELECT'The ACOS of the angle is: '+CONVERT(varchar, ACOS(@angle)) go
5.EXP
返回所给的 float 表达式的指数值 EXP ( float_expression ) DECLARE@varfloat SET@var=378.615345498 SELECT'The EXP of the variable is: '+CONVERT(varchar,EXP(@var)) GO
6.ROUND
返回数字表达式并四舍五入为指定的长度或精度。ROUND ( numeric_expression , length [ , function ] ) selectround(123.45178,2) ,round(123.98765,2),round(123.98765,-2),round(123.56789,0),round(123.56789,0,1) go
返回小于或等于所给数字表达式的最大整数。FLOOR ( numeric_expression ) selectfloor(123.456),floor(-123.456),floor($123.456) go
9.SING
返回给定表达式的正 (+1)、零 (0) 或负 (-1) 号 SIGN ( numeric_expression ) DECLARE@valuereal SET@value=-1 WHILE@value<2 BEGIN SELECTSIGN(@value) SET NOCOUNT ON SELECT@value=@value+1 SET NOCOUNT OFF END SET NOCOUNT OFF GO
10.ATAN
返回以弧度表示的角度值,该角度值的正切为给定的 float 表达式;亦称反正切 ATAN ( float_expression ) SELECT'The ATAN of 0.1472738 is: '+CONVERT(varchar, ATAN(0.1472738)) go
11.LOG
返回给定 float 表达式的自然对数 LOG ( float_expression ) DECLARE@varfloat SET@var=5.175643 SELECT'The LOG of the variable is: '+CONVERT(varchar,LOG(@var)) GO
12.SIN
以近似数字 (float) 表达式返回给定角度(以弧度为单位)的三角正弦值。SIN ( float_expression ) DECLARE@anglefloat SET@angle=45.175643 SELECT'The SIN of the angle is: '+CONVERT(varchar,SIN(@angle)) GO
13.ATN2
返回以弧度表示的角度值,该角度值的正切介于两个给定的 float 表达式之间;亦称反正切 ATN2 ( float_expression , float_expression ) DECLARE@angle1float DECLARE@angle2float SET@angle1=35.175643 SET@angle2=129.44 SELECT'The ATN2 of the angle is: '+CONVERT(varchar,ATN2(@angle1,@angle2 )) GO
14.LOG10
返回给定 float 表达式的以 10 为底的对数 LOG10 ( float_expression ) DECLARE@varfloat SET@var=145.175643 SELECT'The LOG10 of the variable is: '+CONVERT(varchar,LOG10(@var)) GO
返回大于或等于所给数字表达式的最小整数 CEILING ( numeric_expression ) SELECTCEILING($123.45), CEILING($-123.45), CEILING($0.0) GO
17.PI
返回 PI 的常量值 PI ( ) selectpi() go
18.SQRT
返回给定表达式的平方根 SQRT ( float_expression ) DECLARE@myvaluefloat SET@myvalue=1.00 WHILE@myvalue<10.00 BEGIN SELECTSQRT(@myvalue) SELECT@myvalue=@myvalue+1 END GO
19.COS
一个数学函数,返回给定表达式中给定角度(以弧度为单位)的三角余弦值 COS ( float_expression ) DECLARE@anglefloat SET@angle=14.78 SELECT'The COS of the angle is: '+CONVERT(varchar,COS(@angle)) GO
20.POWER
返回给定表达式乘指定次方的值 POWER ( numeric_expression , y ) DECLARE@valueint, @counterint SET@value=2 SET@counter=1
WHILE@counter<5 BEGIN SELECTPOWER(@value, @counter) SET NOCOUNT ON SET@counter=@counter+1 SET NOCOUNT OFF END GO
21.TAN
返回输入表达式的正切值 TAN ( float_expression ) SELECTTAN(PI()/2) go
22.COT
一个数学函数,返回给定 float 表达式中指定角度(以弧度为单位)的三角余切值 COT ( float_expression ) DECLARE@anglefloat SET@angle=124.1332 SELECT'The COT of the angle is: '+CONVERT(varchar,COT(@angle)) GO
23.RADIANS
对于在数字表达式中输入的度数值返回弧度值 RADIANS ( numeric_expression ) DECLARE@anglefloat SET@angle=-45.01 SELECT'The RADIANS of the angle is: '+ CONVERT(varchar, RADIANS(@angle)) GO