Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to select rows with Chinese-Japanese characters?

How can I filter a column by Chinese-Japanese like characters? I am trying to do something like

SELECT * FROM my_table WHERE column LIKE '%[A-Za-z]%'

Is it possible for Chinese or Japanese characters?

like image 734
Kuzgun Avatar asked Oct 17 '25 13:10

Kuzgun


1 Answers

When working with unicode string you will always need to prefix your string with N to tell sql server explicitly that there can be unicode characters in the operation. INSERT, UPDATE, SELECT and DELETE its true for all operations.

In your case when selecting data, in where clause you will need to prefix the Search string with N. Something like this....

SELECT * 
FROM my_table 
WHERE column LIKE N'%[A-Z]%' --<-- using Japanese characters here 
OR    Column LIKE N'%[a-z]%' --<-- using Japanese characters here 
like image 130
M.Ali Avatar answered Oct 19 '25 03:10

M.Ali



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!