日期:2014-05-18 浏览次数:20631 次
create proc usp_CloseEvent @UserGUID VARCHAR(40), --当前处理人的GUID @EventGUID VARCHAR(40),--事件单GUID @Hb VARCHAR(40), --汇报人 @Jzqk VARCHAR(40), --事件单状况 @remarks VARCHAR(4000), --处理说明 @CloseCode VARCHAR(40),--关闭代码 @EventQy VARCHAR(40),--事件起因 @FwMethod VARCHAR(10),--服务方式 @FeedBack VARCHAR(4000), --反馈意见 @stamp VARCHAR(100), @strET VARCHAR(50), @strE1 VARCHAR(50), @strE2 VARCHAR(50), @strE3 VARCHAR(50) AS DECLARE @count int DECLARE @strDepartment VARCHAR(40) DECLARE @strGW VARCHAR(20) DECLARE @date VARCHAR(24) DECLARE @tstamp bigint begin SET @date = getdate() SET @count =0 set xact_abort ON SELECT @strDepartment=CONVERT(varchar(40),DepartmentGUID),@strGW =JobTitle FROM myuser WHERE USERGUID = @UserGUID SELECT @tstamp =convert(bigint,@stamp) BEGIN TRANSACTION BEGIN ---插入数据到处理过程 INSERT INTO Itsm_ProcessReport (ProcessGUID,EventGUID,ProcessTime,ProcessContent,Hander,Receiver,Remarks) VALUES (newid(),@EventGUID,@date,'关闭事件单',@Hb,'',@remarks) SET @count = @count + @@ERROR IF @count <> 0 BEGIN GOTO ERRORHANDLE END END BEGIN ---更新事件单信息 UPDATE Itsm_EventInfo SET EventStatus = @Jzqk,OldStatus= @Jzqk, EventQy = @EventQy ,FwMethod = @FwMethod , CloseCode = @CloseCode , FeedBack = @FeedBack, CloseTime = @date , CloserGUID = @UserGUID,EventLevel=@strET,EventLevel1=@strE1,EventLevel2=@strE 2,EventLevel3=@strE3 WHERE EventGUID=@EventGUID AND CONVERT(bigint,EventStamp) = @tstamp IF @@rowcount=0 BEGIN GOTO ERRORBF END SET @count = @count + @@ERROR IF @count <> 0 BEGIN GOTO ERRORHANDLE END END IF @count=0 begin COMMIT TRANSACTION SELECT 'SUCCESS' end ERRORHANDLE: begin ROLLBACK TRANSACTION SELECT 'FAILED' END ERRORBF: begin ROLLBACK TRANSACTION SELECT 'BF' end END
IF @count=0 begin COMMIT TRANSACTION SELECT 'SUCCESS' RETURN end
------解决方案--------------------
try this,
create proc usp_CloseEvent @UserGUID VARCHAR(40), --当前处理人的GUID @Event