devxlogo

Identify Tables with Large Column Counts

Identify Tables with Large Column Counts

You can identify tables with a huge column count in the following way:

DECLARE @limit INT;SET @limit = 30; --MAX 30 Columns;WITH c([object_id], [column count]) AS(  SELECT [object_id], COUNT(*)    FROM sys.columns    GROUP BY [object_id]    HAVING COUNT(*)  @limit)SELECT [table] = s.name + N'.' + t.name,    c.[column count]  FROM c  INNER JOIN sys.tables AS t  ON c.[object_id] = t.[object_id]  INNER JOIN sys.schemas AS s  ON t.[schema_id] = s.[schema_id]  ORDER BY c.[column count] DESC; 
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist