Get the column name length distribution in Azure SQL Database

The query below returns the distribution of the column name lengths (number of characters).


select len( as column_name_length,
       count(*) as columns,
       count(distinct tab.object_id) as tables
   from sys.tables as tab
       inner join sys.columns as col 
       on tab.object_id = col.object_id
group by len(
order by len(


  • column_name_length - length in characters of the column name
  • columns - number of columns with this length
  • tables - number of tables that have columns with this name length


  • One row: represents one name length (number of characters)
  • Scope of rows: each column length that exists in a database
  • Ordered by: length in ascending order (from 1 to max)

Sample results

If you put it into chart, it looks like this:

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