BRONZE PARTNER:
BRONZE PARTNER:
Industry News:

| |
| |
 |
 |
 |
 |
 |
| SQL Query To Find Table Dependencies |
 |
|
|
By: Don Hite
Posted On: 12/6/2007
This article was Previously posted on Don Hite's Blog Use this SQL script to return the table dependencies such as stored procedures for your database objects.
You need to change the XType value referenced in the query below to find any of the objects in the following chart:
C = Check Vonstraint D = Default or Default Constraint F = Foreign Key Constraint L = Log Fn = Scalar Function If = Inlined Table Function P = Stored Procedure Pk = Primary Key Constraint Rf = Replication Filter Stored Procedure S = System Table Tf = Table Function Tr = Trigger U = User Table Uq = Unique Constraint V = View
SQL Query:
Select Distinct SysObjects.Name 'Table Name', Procedures.Name 'Stored Procedure'
From SysObjects Join (SysObjects Procedures Join SysDepends on Procedures.Id = SysDepends.Id) On SysDepends.DepId = SysObjects.Id
Where SysObjects.XType = 'U'
-- Change XType Values here using chart above And Procedures.XType = 'P'
Group by SysObjects.Name, SysObjects.Id, Procedures.Name
Order by SysObjects.Name Asc
|
 |
 |
 |
|
|