SELECT TABLE_NAME , COUNT(*) AS NumColumn
FROM INFORMATION_SCHEMA.COLUMNS
GROUP BY TABLE_NAME
ORDER BY TABLE_NAME
เลือกเฉพาะชนิดที่เป็น Table
SELECT TABLE_NAME , COUNT(*) AS NumColumn
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME IN (SELECT name FROM sysobjects WHERE xtype='U')
GROUP BY TABLE_NAME
ORDER BY TABLE_NAME