1 ------------------------------------ 2 --用途:员工管理 3 --时间:2011-2-24 8:18:31 4 ------------------------------------ 5 alter proc DKI_StaffManage 6 ( 7 @CMD varchar(20)='', 8 @staffcode varchar(50)='', 9 @staffName varchar(50)='', 10 @flg int=0, 11 @returnvalues int=0 output 12 ) 13 as 14 begin tran 15 if(@CMD='select') 16 begin 17 if(@flg=1) 18 begin 19 select top 100 * from Opt_DKI_Staff order by staffID desc 20 end 21 else if(@flg=2) ---2为查询 22 begin 23 select * from Opt_DKI_Staff where 24 end 25 end 26 else if(@CMD='insert') 27 begin 28 if (select count(*) from Opt_DKI_Staff where 0">StaffCode=@staffcode)>0 29 begin 30 set @returnvalues=0 31 end 32 else 33 begin 34 insert into Opt_DKI_Staff (StaffCode,StaffName) values (@staffcode,@staffName) 35 set @returnvalues=1 36 end 37 end 38 else if(@CMD='update') 39 begin 40 update Opt_DKI_Staff set where 41 end 42 else if(@CMD='delete') 43 begin 44 delete Opt_DKI_Staff where 45 end 46 commit tran 47 return