Find tables that are not used by any other object in Azure SQL database

Bart Gawrych - Dataedo Team Bart Gawrych 2019-02-18

Table of Contents:

    Article for: Azure SQL Database SQL Server Oracle database

    Query below lists all tables that are not referenced by any object .


    select schema_name(schema_id) as schema_name,
           name as table_name
    from sys.tables tab
    left join sys.sql_expression_dependencies dep
              on tab.object_id = dep.referenced_id
    where dep.referenced_id is null
    order by schema_name,


    • schema_name - schema name of the table
    • table_name - table name


    • One row represents one table that is not used by any other object
    • Scope of rows: all objects that are not used by any other object
    • Ordered by schema name and table name

    Sample results

    There are no comments. Click here to write the first comment.

    By continuing to use our website, you consent to the use of cookies in accordance with our Privacy Policy.