Value varchar(1000) declare @ID integer declare @ParentID integer set @ID = -1 select top 1 @ID=isnull([ID],0),@ParentID = isnull([ParentID],0) from tree where ID = @X while @id <> @parentid and @parentid <> 0 and @ID >0 and '-' + isnull(@ReturnValue,'') +'-' not like '%-' + cast(@id as varchar) + '-%' begin if @ReturnValue is not null set @ReturnValue = '-' + @ReturnValue set @ReturnValue= cast(@id as varchar) + isnull(@ReturnValue,'') set @id = -1 select top 1 @ID=isnull([ID],0),@ParentI页码:[1] [2] [3] [4] [5] [6] [7] [8] 第5页、共8页 |