Stored procedures and its dependent objects

>>Script Language and Platform: MS SQL Server 7.0/2000
This simple select statement could present you

(1) All the user defined stored procedures in the current database

(2) Stored procedure’s dependencies; stored procedure’s related objects (tables, views)

(3) Actions on the tables or view when executing the stored procedure – Select, Insert, Update and Delete

Author: Claire Hsu

–ProcName indicates the stored procedure nane
–TableOrView presents the stored procedrues relate objects
–The following are the action from stored procedure’s perspective
‘select’ = case WHEN c.text like ‘%select %’ THEN ‘Select’ ELSE ” END,
‘Update’ = case WHEN c.text like ‘%update %’ THEN ‘Update’ ELSE ” END,
‘Delete’ = case WHEN c.text like ‘%delete %’ THEN ‘Delete’ ELSE ” END,
‘Insert’ = case WHEN c.TEXT LIKE ‘%Insert %’ THEN ‘Insert’ ELSE ” END FROM
Sysdepends a INNER JOIN Sysobjects b ON a.ID = b.ID
INNER JOIN Syscomments c
ON a.ID = c.ID
WHERE b.Status > 0

We hope that the information on these script pages is
valuable to you. Your use of the information contained in these pages,
however, is at your sole risk. All information on these pages is provided
“as -is”, without any warranty, whether express or implied, of its accuracy,
completeness, or fitness for a particular purpose…

Disclaimer Continued

Back to Database Journal Home

Latest Articles