示例|数据|显示树形数据显示SQL示例代码(在ms sql 2000 DBMS中调试通过)
SELECT DeptCode1 + DeptCode2 + DeptCode3 AS dpcode,
CASE WHEN deptname2 = '' THEN deptname1 WHEN deptname2 <> '' AND
deptname3 = '' THEN DeptName1 + '\' + DeptName2 WHEN deptname2 <> '' AND
deptname3 <> '' THEN DeptName1 + '\' + DeptName2 + '\' + DeptName3 END AS dpname
FROM dbo.Department