在cnblogs上的专栏

导航

树形数据显示SQL示例代码(在ms sql 2000 DBMS中调试通过)

树形数据显示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

posted on 2006-10-23 14:28  Double_  阅读(220)  评论(0编辑  收藏  举报