sql - List of tables used in all stored procedures with SP's schema name -
how list of tables used in stored procedures stored procedure's schema name? have seen answer here. not listing stored procedure’s schema name. know how retrieve schema name of stored procedure too?
try query:
select * information_schema.routines
this return stored procedure in current database , schema associated it.
if want tables , related stored procedure try this:
select t.table_name, s.routine_name,s.specific_schema information_schema.tables t inner join information_schema.routines s on s.routine_name in ( select referencing_entity_name sys.dm_sql_referencing_entities(table_schema + '.' + table_name, 'object') ) , s.routine_type = 'procedure' t.table_type = 'base table'
stay away sysobject etc views
Comments
Post a Comment