CREATE PROCEDURE [dbo].[up_set_timeskillreset] @char_id [uniqueidentifier] ,@flag int as begin declare @sp int declare @character_id [uniqueidentifier] set @sp = -1 set nocount on select @character_id = character_id from CharacterTable with (READUNCOMMITTED) where character_id = @char_id if( @character_id IS NOT NULL ) begin if( @flag = 0 ) --½ºÅ³±â°£Á¦ ÃʱâÈ­ ÀÔ·Â begin select @sp = SP from CharacterTable with (READUNCOMMITTED) where character_id = @char_id update CharacterTable set time_sp = @sp where character_id = @char_id update SkillTable set [use] = 0 where character_id = @char_id end else begin select @sp = time_sp from CharacterTable with (READUNCOMMITTED) where character_id = @char_id update CharacterTable set SP = @sp, time_sp = 0 where character_id = @char_id delete from SkillTable where character_id = @char_id and [use] = 1 update SkillTable set [use] = 1 where character_id = @char_id end end end