CREATE function [dbo].[GetClassPath](@classSonID nvarchar(50),@sperator
nvarchar(5))
returns nvarchar(MAX)
as
begin
declare @parentid
nvarchar(50);
declare @classPath nvarchar(255);
select @classPath=Name,@parentid=parentid from [o.class] where
id=@classSonID;
if(@parentid !=‘0‘)
begin
set
@classPath=dbo.GetClassPath(@parentid,@sperator)+@sperator+@classPath;
end
return
@classPath;
end