I’m able to pull cross databases dependencies but when the referencedDB is DIFFERENT DATABASE then I’m able to fetch the referenced object but not referenced OBJECT TYPE (e.g user_table,stored procedure etc..,)
Is there any way to find the OBJECT TYPE of referencedDB object?
Thanks in advance.
Advertisement
Answer
The system views (e.g., sys.object) are views, effectively under the schema sys.
So you should be able to get object types etc from statements like
SELECT type_desc FROM yourOtherDatabaseName.sys.Objects WHERE name = 'yourObjectToCheck'
Note – Information_schema is also similar – you can use them like
SELECT TOP 10 * from yourOtherDatabaseName.INFORMATION_SCHEMA.tables