MySQL query the limit set of a data type

If I set a data field to let’s say TEXT(500) or VARCHAR(500) Is there a way for me to query this so that I can use that value and match my form limit to that set in the database?

1 Like

yes… write your query against this table –

select column_name , data_type , character_maximum_length -- here ya go from information_schema.columns where table_name = 'daTable'

1 Like

@937 So cool… I was worried that I’d have to hack some ugly code to do this so thanks… again r937
Oh and I just found that even if you set a limit on type ‘TEXT’ as in TEXT(500) the query still returns 65535 as if no limit has been set. However varchar(500) returns 500…strange!

1 Like

strange? wait’ll you try to store the number 123,456,789 in an INTEGER(3) column!!


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.