getfullpath.sql

来自「实现表结构为 ID」· SQL 代码 · 共 23 行

SQL
23
字号
CREATE        FUNCTION FullClassPath (@ClassID  int)  
RETURNS nvarchar(4000) AS  
BEGIN 

 DECLARE @temPath nvarchar(4000)
 DECLARE @temID int
 select  @temPath =name,@temID=parentid from patentclass where id = @ClassID
 if (@temID is null)
  return @temPath;
 else
  begin
	
	while(not (@temid is null))
	begin
		select @temPath = name +'\' + @temPath,@temID=parentid from patentclass where id = @temID
	
		
	end
  end
 
 return @temPath
END

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?