2,596
社区成员
发帖
与我相关
我的任务
分享
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER proc [dbo].[selectp]
@id int
as
declare @pid int
declare @s varchar(400)
set @pid=0
set @s=''
select @pid=parent_id from dbo.commonsite_pcls where id=@id
while @pid<>0
begin
select @pid=parent_id,@s=cls_name+'-'+@s from dbo.commonsite_pcls where id=@pid
end
select id,@s+cls_name as cls_name from dbo.commonsite_pcls where id=@id