Friday, June 6, 2014

FIND HIGHEST COLUMN COUNT IN A TABLE WITH IN A DATABASE


 select * from INFORMATION_SCHEMA.columns


 SELECT TOP 1 TABLE_NAME ,COUNT(COLUMN_NAME) AS CNT
 FROM INFORMATION_SCHEMA.COLUMNS GROUP BY TABLE_NAME ORDER BY 2 DESC

No comments:

Post a Comment