List the Objects referenced outside of the db

  • Hi there,

    Need to find the list of objects that are referenced from the outside of current database. Example

    Use TestDB1

    Create Proc TestProc as begin

    select * from TestDB1..Sysobjects

    select * from sys.indexes

    end

    Need a query which able to return the following

    LinkedServername, Databasename, TableName

    null ,TestDB1 , Sysobjects

  • Quick suggestion, use the sys.sql_expression_dependencies system view

    😎

    SELECT

    SD.*

    FROM sys.sql_expression_dependencies SD

    WHERE SD.referenced_database_name IS NOT NULL

    ;

  • Eirikur Eiriksson (2/23/2015)


    Quick suggestion, use the sys.sql_expression_dependencies system view

    😎

    SELECT

    SD.*

    FROM sys.sql_expression_dependencies SD

    WHERE SD.referenced_database_name IS NOT NULL

    ;

    Great.. works fine

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply