alter procedure dbo.spUpdatePropertyValue(@propertyId int, @value nvarchar(255), @personId int=null) as begin set nocount on if( @personId is null ) select @personId=iPersonId from tPerson where bPersonSystem=1 insert into tblLog (lintNodeId,dteLog,liLogPersonId,lintLogKindId,KindId,txtLog) select p.lintNodeId, getutcdate(), @personId, 4, k.intKindId, replace(replace(replace((select txtText from tblDict where lintPropEditMsgId=1), '$1', k.txtName), '$2', isnull(p.txtValue,'')), '$3', isnull(@value,'')) from tblProperty p join tblKind k on k.intKindId=p.lintKindId join tblNode n on n.intNodeId=p.lintNodeId and isnull(n.intState,0)&128=0 where isnull(p.txtValue,'')!=isnull(@value,'') and p.intPropertyId=@propertyId set nocount off update tblProperty set txtValue=@value where intPropertyId=@propertyId and isnull(txtValue,'')!=isnull(@value,'') declare @isValChanged bit=case when @@rowcount>0 then 1 else 0 end --after SET NOCOUNT ON, @@ROWCOUNT returns 0 set nocount on if @isValChanged=1 begin declare @nodeId int select @nodeId=lintNodeId from tblProperty where intPropertyId=@propertyId exec dbo.spCalcNodeName @nodeId exec spUpdatePropCache_PropValChanged @propertyId return 1 end return 0 end