How to know the maximum length of a field

2008-04-29 Thread Charles Lambach
Hi. I've got a table with some fields, which I created with VARCHAR(100). I want to optimize this table, and I want to modify the length of these fields from VARCHAR(100) to VARCHAR(maximum_length), where maximum_length is the length of the record with the longest field. I could create a Perl

Re: How to know the maximum length of a field

2008-04-29 Thread C.R.Vegelin
Hi Charles, to get max . # characters: SELECT MAX(CHAR_LENGTH(fieldname)) AS `MaxChars`; to get max. # bytes: SELECT MAX(LENGTH(fieldname)) AS `MaxBytes`; HTH, Cor - Original Message - From: Charles Lambach [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Tuesday, April 29, 2008

Re: How to know the maximum length of a field

2008-04-29 Thread kabel
On Tuesday 29 April 2008 08:21:37 Charles Lambach wrote: Hi. I've got a table with some fields, which I created with VARCHAR(100). I want to optimize this table, and I want to modify the length of these fields from VARCHAR(100) to VARCHAR(maximum_length), where maximum_length is the length