Hi Guys
Need a bit of assistance here.
We have Stored proc designed in our live system which queries views, function, linked server((which queries tables and its columns)) etc
Is their a quick and easy way of getting list of all views(so what tables and columns is it referencing to) , temp tables(so what tables and column is it referencing to),tables (what column is it referencing too from a specific SP.
So for example
So far I have been using this
SELECT referenced_database_name,
case when referenced_Schema_name = '' or referenced_schema_name is null then 'dbo' else referenced_schema_name end as [referenced_schema_name],
referenced_entity_name,
referenced_minor_name,
(referenced_entity_name+'.'+referenced_minor_name)as Field,
((case when referenced_Schema_name = '' or referenced_schema_name is null then 'dbo' else referenced_schema_name end )+'.'+referenced_entity_name) as [Table],
case when referenced_database_name in ('Catalogue','Reflex') then referenced_database_name else NULL end as [Database]
FROM sys.dm_sql_referenced_entities(N'dbo.AgeofRptds','OBJECTS')
This query is telling me what database is being used, what table is being used and what columns are being queried .
Can i have an assistance of a similar like one combined query which can be used to get all database, views(what table and column is being referenced), temp tables(what table and column is being referenced), functions
Regards
Farhan Jamil