mahdi pishguy mahdi pishguy - 1 month ago 12
MySQL Question

How can i get mySql column Length/Values

I can get column table information with this command, but that don't return column

Length/Values
, how can i get that?

SELECT COLUMN_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'tableName'

Answer

SQL has a LEN() Function. Which will give you a length so could try something like:

SELECT COLUMN_NAME, LENGTH(COLUMN_NAME) as Column Length, DATA_TYPE, LENGTH(DATA_TYPE) as Data Length ...

Hope that helps