Question : capture sp_depends into temptable

what am i doing wrong with this query?

create table sp_dep (name varchar (1000), type varchar(100))
exec sp_MSforeachtable
'
insert sp_dep
EXEC sp_depends ''?''
'

Answer : capture sp_depends into temptable

Sure, can always some of the system views - there are ways of exposing them if you want to hide it a bit more...

SELECT SCHEMA_NAME(o.schema_id) AS dependent_object_schema
  ,OBJECT_NAME(o.object_id) AS dependent_object_name
  ,o.type_desc AS dependent_object_type
  ,d.class_desc AS kind_of_dependency
  ,TYPE_NAME (d.referenced_major_id) AS type_name
  ,d.*
FROM sys.sql_dependencies AS d
JOIN sys.objects AS o
  ON d.object_id = o.object_id

-- where class = 1 for tables....
Random Solutions  
 
programming4us programming4us