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

Article for: Azure SQL Database 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.