List tables with the largest number of columns in Azure SQL Database

The query below returns tables with their number of columns, ordered from highest to lowest.


select schema_name(tab.schema_id) + '.' + as [table], 
       count(*) as [columns]
   from sys.tables as tab
        inner join sys.columns as col
            on tab.object_id = col.object_id
group by schema_name(tab.schema_id),
order by count(*) desc


  • table - name of the table (with schema name)
  • columns - number of columns in table


  • One row: represents one table in a database
  • Ordered by: number of columns in descending order - from tables with the largest number of columns to the lowest

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.