求10的阶乘
声明变量,此时要注意初始值不能为0了,因为它是做乘法运算的...
declare @i int; declare @result int; set @i = 1; set @result = 1; while(@i<10) begin set @result = @result * @i; set @i = @i +1; end print @result;
求10的阶乘
声明变量,此时要注意初始值不能为0了,因为它是做乘法运算的...
declare @i int; declare @result int; set @i = 1; set @result = 1; while(@i<10) begin set @result = @result * @i; set @i = @i +1; end print @result;