SQL存储过程实例.doc

时间:2013-07-20 11:08:23
【文件属性】:

文件名称:SQL存储过程实例.doc

文件大小:106KB

文件格式:DOC

更新时间:2013-07-20 11:08:23

SQL 存储过程 实例

--1、创建存储过程-- if exists (select * from sysobjects where name='Sum_wage') drop procedure Sum_wage GO create procedure Sum_wage @PWage int, @AWage int, @total int as while (1=1) begin if (select count(*) from ProWage)>2*(select count(*) from ProWage where Wage>=@PWage) update ProWage set @total=@total+@AWage,Wage=Wage+@AWage else break end print'一共加薪:'+convert(varchar,@total)+'元' print'加薪后的程序员工资列表:' select * from ProWage --调用存储过程1-- exec Sum_wage @PWage=2000,@AWage=100,@total=0 exec Sum_wage @PWage=2200,@AWage=100,@total=0 exec Sum_wage @PWage=3000,@AWage=100,@total=0 exec Sum_wage @PWage=4000,@AWage=100,@total=0 exec Sum_wage @PWage=5000,@AWage=100,@total=0 exec Sum_wage @PWage=6000,@AWage=100,@total=0


网友评论