Technical Article

When sp_depends fails

,

sp_depends will fail to display correct information if there have been changes in views / tables /stored procs (dropping / recreating etc).

To actually parse through the definitions of stored procedures and find all that use certain table, function or other stored procedure, you can use the fragment above.

Replace the 'table_name_here' placehodler with the name of the object you want to search for.

I have seen cases where sp_depends returns 10-15 stored procedures while this query returns more than 30.

SELECT * FROM information_schema.routines r WHERE charindex('table_name_here', r.ROUTINE_DEFINITION)>0

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating