List of all Tables in Sybase

CREATE TABLE #TT (IDENT NUMERIC(12) IDENTITY,
...... all the rest of your columns in your result set...)

SELECT ob.name as ParentProc, bo.name as ChildProc, bo.type as ChildType
INTO #procdepends
FROM sysdepends dp
JOIN sysobjects ob ON ob.id = dp.id
JOIN sysobjects bo ON bo.id = dp.depid
WHERE ob.type = 'P' AND bo.type = 'P'

INSERT INTO #TT
select pd1.ParentProc as Root, isnull(pd1.ChildProc,'') as Level1,
isnull(pd2.ChildProc,'') as Level2,
isnull(pd3.ChildProc,'') as Level3, isnull(pd4.ChildProc,'') as Level4,
isnull(pd5.ChildProc,'') as Level5
from #procdepends pd1
left outer join #procdepends pd2
on pd2.ParentProc = pd1.ChildProc
left outer join #procdepends pd3
on pd3.ParentProc = pd2.ChildProc
left outer join #procdepends pd4
on pd4.ParentProc = pd3.ChildProc
left outer join #procdepends pd5
on pd5.ParentProc = pd4.ChildProc
left outer join #procdepends pd6
on pd6.ParentProc = pd5.ChildProc
where pd1.ParentProc not in (select ChildProc from #procdepends)
order by pd1.ParentProc, pd1.ChildProc,
pd2.ChildProc, pd3.ChildProc,
pd4.ChildProc, pd5.ChildProc,
pd6.ChildProc

SELECT CASE WHEN A.ROOT = B.ROOT THEN '' ELSE A.ROOT END AS ROOT,
CASE WHEN A.LEVEL1 = B.LEVEL1 THEN '' ELSE A.LEVEL1 END AS LEVEL1,
............ the rest of your levels the same way....
FROM #TT A -- Current record
LEFT OUTER JOIN #TT B -- Prior record
ON A.IDENT = B.IDENT + 1

Hiç yorum yok:

Visual Studio 2017'de Devexpress 17.2.5 Toolbox görünmüyor

Visual Studio 2017 Toolbox'ı üzerinde Developer Express componentlerini göremiyorsanız aşağıdaki komutu çalıştırmak işini görecektir. (...