title: Check table columns reached max length
body: <p>Just wondering whether there is a way to check columns of a table reached thire maximum length.</p>
  
  <p>With following I was able to get the length of the table column</p>
  
  <pre><code>SELECT MAX(CHARACTER_MAXIMUM_LENGTH) AS LEN, COLUMN_NAME
  FROM information_schema.columns
  WHERE table_name IN ('TableA')
  GROUP BY COLUMN_NAME 
  ORDER BY LEN DESC
  </code></pre>
  
  <p>And then I wanted to check whether those column reached its MAX length or not with data</p>
  
  <p>Below gives the max length a column</p>
  
  <pre><code>SELECT MAX(LENGTH(Col1))
  FROM TableA
  </code></pre>
  
  <p>As it is not possible to use aggregate functions in <code>WHERE</code> clause, how it is possible?</p>
  
  <p>Thanks</p>