正在加载图片...
912存储过程的创建 【例9-1】创建一个存储过程,用来求任意一个数的阶乘。 use xg if exists (select name from sysobjects where name=fact and type =p) drop proc fac create procedure fact @n int, @f int output as if @n<0 print'你输入了的+cast@ n as varchar(20)+,请输入非负数 else begi declare @i int set @i= set @f=1 while @i<=@n begin set @f=@f@i set @i=@i+1 end print cast@ n as varchar(20)+的阶乘是:'+cast(@ f as varchar(20) end9.1.2 存储过程的创建 【例9-1】 创建一个存储过程,用来求任意一个数的阶乘。 use jxgl if exists(select name from sysobjects where name='fact' and type ='p') drop proc fact go create procedure fact @n int,@f int output as if @n<0 print '你输入了的'+cast(@n as varchar(20))+',请输入非负数' else begin declare @i int set @i=1 set @f=1 while @i<=@n begin set @f=@f*@i set @i=@i+1 end print cast(@n as varchar(20))+'的阶乘是:'+cast(@f as varchar(20)) end
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有