1 WITH TempDeptment ([ID],[PID],[DeptName],[Conjunction]) AS 2 ( 3 SELECT [ID],[PID],[DeptName], CAST([DeptName] AS Nvarchar(1000)) FROM [dbo].[Deptment] WHERE [PID] = 0 4 UNION ALL 5 SELECT d.[ID], d.[PID], d.[DeptName], CAST(([Conjunction] + N'/' + d.[DeptName]) AS Nvarchar(1000)) FROM TempDeptment AS td,[dbo].[Deptment] AS d WHERE td.[ID] = d.[PID] 6 ) 7 SELECT [ID], [Conjunction] FROM TempDeptment