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

Article for: 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

Comments are only visible when the visitor has consented to statistics cookies. To see and add comments please accept statistics cookies.
There are no comments. Click here to write the first comment.