1 ALTER proc [dbo].[Dki_GBC_DownloadHistory] 2 ( 3 @CMD varchar(20), 4 @ContactPersonID int=0, 5 @UserID int=0 ---用户 6 ) 7 as 8 if @CMD is null 9 begin 10 print N‘param @CMD can not is null!‘ 11 return 0 12 end 13 begin tran 14 ----------------------------------- 15 --用途:增加下载历史!并批量录入数据。 16 --时间:2011-1-23 8:18:31 17 ------------------------------------ 18 if(@CMD =‘insert‘) 19 --if(select count(*) from GBCDownloadHistory where 0">[email protected])>0 20 -- return 0 21 insert into GBCDownloadHistory (ContactPersonID,UserID,Download_Date) 22 select ContactPersonID,@UserID,getdate()from GBClist where 23 ----gbc详细显示 24 else if(@CMD=‘view‘) 25 begin 26 select gbc.*,hist.Download_Date from gbclist as gbc 27 Left join GBCDownloadHistory as hist ON hist.ContactPersonID = gbc.ContactPersonID 28 where 29 end 30 if @@error <>0 31 begin 32 rollback 33 return 0 34 end 35 else 36 begin 37 commit 38 return 1 39 end 40 41 收藏于 2011-03-09
原文地址:https://www.cnblogs.com/dqh123/p/9470092.html
时间: 2024-11-08 21:27:28