List graph tables in SQL Server database

Article for: Azure SQL Database

This query works on SQL Server 2017 or newer.

SQL Server 2017 introduced graph tables.

Query below returns those tables.

Query

select case when is_node = 1 then 'Node'
            when is_edge = 1 then 'Edge'
        end table_type,
        schema_name(schema_id) as schema_name,
        name as table_name
from sys.tables
where is_node = 1 or is_edge = 1
order by is_edge, schema_name, table_name

Columns

  • table_type - graph table type - Node and Edge
  • schema_name - table schema name
  • table_name - table name

Rows

  • One row represents one graph table - node or edge
  • Scope of rows: only graph (node or edge) tables are included
  • Ordered by nodes first, then edeges. Within type by schema 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.
0
There are no comments. Click here to write the first comment.