Why does UPPER () not work in MySQL?

My SQL query selects some columns from a view with an optional sort field. Basically, my view combines multiple fields into a single address bar, so I get something like

123 Sesame Street Birdtown

in the address column. I want the search to be case insensitive (this is not the default), so I tried this:

SELECT * FROM BasicJobInfo WHERE UPPER(address) LIKE UPPER(searchString)

where searchString is the address I want to find. However, MySQL does not seem to be able to convert the address to UpperCase - I tried just calling

SELECT UPPER(address) FROM BasicJobInfo

but this does not change the situation at all. Any thoughts on why this might be? Also, any suggestions on how else I can do a case insensitive search?
Many thanks.

+3
source share
3

MySQL String:

UPPER() (BINARY, VARBINARY, ).

, ADDRESS BINARY, VARBINARY BLOB?

"" . :

UPPER(CONVERT(ADDRESS USING latin1))
+11

. mysql. UTF8, :

SELECT *
FROM YourTable
WHERE address LIKE 'searchString' COLLATE utf8_general_ci;
+1

:

SELECT  @@character_set_server, @@collation_server

SELECT  HEX(CAST(UPPER(address) AS binary)), HEX(CAST(address AS binary))
FROM    BasicJobInfo
0

Source: https://habr.com/ru/post/1710844/


All Articles