[Solved] Find number of rows of each column name [duplicate]


Assuming that there aren’t any partitioned table:

USE [SpecificDatabank]
SELECT
  sys.columns.name AS ColumnName,
  sys.tables.name AS TableName,
  sys.partitions.rows AS [Rows]
FROM
  sys.columns
JOIN sys.tables ON
  sys.columns.object_id = sys.tables.object_id
JOIN sys.partitions ON
  sys.tables.object_id = sys.partitions.object_id and sys.partitions.index_id in (0,1)
WHERE
  sys.columns.name LIKE '%ColumnName%'

1

solved Find number of rows of each column name [duplicate]