I believe there is a function that I can use to determine the string length but I can't find it on Google. What I want is all rows greater than 255 characters. Can someone please shed some light?
A:
Sure, length()
*, and char_length()
. See http://dev.mysql.com/doc...function_length and http://dev.mysql.com/doc...function_char-length
Example:
SELECT name, email
FROM subscribers
WHERE (char_length(name) > 5)
LIMIT 1
--
* Returns the length of the string str, measured in bytes. A multi-byte character counts as multiple bytes. This means that for a string containing five two-byte characters, LENGTH() returns 10, whereas CHAR_LENGTH() returns 5.
Jonathan Sampson
2009-12-04 01:34:23
Thanks. I already tried that but I'm not quite sure how to use that with a where clause and I can't find an example
Tim
2009-12-04 01:35:41
Try the updated example, Tim.
Jonathan Sampson
2009-12-04 01:38:16
+1
A:
Try this:
select *
from table
where length(somefield) > 255;
You have the strange wording that "some row is greater than 255 characters". That might mean
select *
from table
where length(somefield1) + length(somefield2) + length(somefield3) > 255;
wallyk
2009-12-04 01:36:10
A:
You can not find the length of a row (unless that row is made up of only one field). You can find the length of individual fields in a row which have string data in them with length()
and char_length()
.
Donnie
2009-12-04 01:39:05