all groups > sql server programming > january 2004 >
You're in the

sql server programming

group:

How to select records containing Chinese Characters


How to select records containing Chinese Characters saiwing.lam NO[at]SPAM hk.unisys.com
1/19/2004 10:48:25 PM
sql server programming: I have a table, TABLE1 with 2 fields:

ID Name
-------- ---------------
1 Mary Wong
2 (Name in Chinese Character)
3 John Lee
4 (Name in Chinese Character)

I want to write a SQL statement to replace the names in Chinese to blank:

ID Name
-------- ---------------
1 Mary Wong
2 (blank)
3 John Lee
4 (blank)

The SQL Statement should be like this:
UPDATE
TABLE1
SET
Name = ''
WHERE
<Name containing Chinese Character>

Re: How to select records containing Chinese Characters Sai Wing LAM
1/20/2004 12:26:27 AM
Thanks for your advise, but I don't it works on Chinese Characters as
there are almost 30K character to replace for.
It's not possible to build such a big table.

*** Sent via Developersdex http://www.developersdex.com ***
Re: How to select records containing Chinese Characters Uri Dimant
1/20/2004 9:40:27 AM
Lam
Look , I had the same problem with Hebrew.
I solved it in the following way
SELECT * INTO #temp
FROM
(
SELECT '?', SPACE(1) UNION
SELECT '?', SPACE(0) UNION
SELECT '?', SPACE(0) UNION
SELECT '?', SPACE(0) UNION
SELECT '?', SPACE(0) UNION
SELECT '?', SPACE(0) UNION
SELECT '?', SPACE(0) UNION
SELECT '?', SPACE(0) UNION
SELECT '?', SPACE(0) UNION
SELECT '?', SPACE(0) UNION
SELECT '?', SPACE(0) UNION
SELECT '?', SPACE(0) UNION
SELECT '?', SPACE(0) UNION
SELECT '?', SPACE(0) UNION
SELECT '?', SPACE(0) UNION
SELECT '?', SPACE(0) UNION
SELECT '?', SPACE(0) UNION
SELECT '?', SPACE(0) UNION
SELECT '?', SPACE(0) UNION
SELECT '?', SPACE(0) UNION
SELECT '?', SPACE(0) UNION
SELECT '?', SPACE(0) UNION
SELECT '?', SPACE(0) UNION
SELECT '?', SPACE(0) UNION
SELECT '?', SPACE(0) UNION
SELECT '?', SPACE(0) UNION
SELECT '?', SPACE(0)
) AS a (Dirty, Good)

WHILE EXISTS (select tooldesc from table where tooldesc like '%[?-?]%')
UPDATE table SET tooldesc=REPLACE(tooldesc,Dirty,Good)
FROM #temp WHERE CHARINDEX(Dirty,tooldesc) > 0




[quoted text, click to view]

AddThis Social Bookmark Button