代码改变世界

SQL BEGIN TRAN

2011-09-14 15:40  yuejianjun  阅读(620)  评论(0编辑  收藏  举报
USE [FastDB]
GO
/****** Object:  StoredProcedure [dbo].[sp1_CommunitySearch_UpdateKeywordSearchLog_ByID]    Script Date: 09/14/2011 15:38:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER Procedure [dbo].[sp1_CommunitySearch_UpdateKeywordSearchLog_ByID]
(@ID int = -1) as
declare @counts int
DECLARE @retcode int   
begin
select @Counts=userClickCount from KeywordSearchLog where id=@ID
set @counts = @counts+1
    SET LOCK_TIMEOUT 1000   
        BEGIN TRAN 
    EXEC @retcode = sp3_KeywordSearchLog_u @id=@ID,@userClickCount=@counts
    SELECT @retcode = @@ERROR    
    IF @retcode = 0                     
     BEGIN    
      COMMIT    
      RETURN 100                        
     END     
     ELSE                        
     BEGIN    
      ROLLBACK    
      RETURN @retcode                    
     END    
end