Question

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?

No correct solution

OTHER TIPS

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 

Below may work as it did for me.

    SELECT * FROM my_table WHERE LEN(RTRIM(my_column)) <> DATALENGTH(RTRIM(my_column))

The len function may ignore trailing whitespaces so it's best to trim it before measuring the length. Above came from advise on a Japanese web page.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top