SQL Server determines whether a field contains Chinese/English characters/numbers

Due to the recent cleaning of dirty data in the system, it is necessary to query whether a field contains data of Chinese/English characters/numbers.

It is relatively simple, just make a brief summary of this blog for future reference.

1. Determine whether a field contains Chinese characters

SELECT  *
FROM    dbo.Channel_ShopCommodity
WHERE   Disabled = 0
        AND StoreCode LIKE '%[吖-座]%';

2. Determine whether a field contains English characters 

SELECT  *
FROM    dbo.Channel_ShopCommodity
WHERE   Disabled = 0
        AND StoreCode LIKE '%[a-z]%';

 

3. Determine whether a field contains numbers

SELECT  *
FROM    dbo.Channel_ShopCommodity
WHERE   Disabled = 0
        AND ShopCommodityName LIKE '%[0-9]%';

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325216757&siteId=291194637