Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 sysdepends and sysobjects

Author  Topic 

svicky9
Posting Yak Master

232 Posts

Posted - 2006-09-05 : 13:52:13
Hi Friends

I am trying to find a query for all the objects and their dependencies using the system tables sysdepends and sysobjects

I got till this query

select so.name as [Object Name],
so1.name as [Depended Object]
from sysobjects so
join sysdepends sd on
so.id = sd.id
join sysobjects so1
on so1.id = sd.depid

I want to make it a pivot table like

Object name Dependencies
Obj1 Dep1,Dep2,Dep3
Obj2 Dep1,Dep2,Dep3
..

and so on

So how do i pivot this table

or is there anyway that the query can look better?

Vic

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2006-09-05 : 13:56:55
Before you go down that road, are you aware that sysdepends may not have all dependent objects? For instance cross database dependencies won't be in there. Also, I believe sql will allow you to compile an SP that uses a function that hasn't been compiled yet. So if you create your objects "out of order" you could end up with a missing sysdepends rows.

Be One with the Optimizer
TG

EDIT:
however, here are some references to pivoting data:
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55210&SearchTerms=pivot
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-09-05 : 20:58:52
Also read about Cross-tab Reports in sql server help file

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -