Warm tip: This article is reproduced from serverfault.com, please click

How to differentiate between 2 Arabic letters in SQL Server

发布于 2020-11-28 23:23:17

In Arabic there are 2 letters that pronounced the same but written differently

The letter ة

and the letter ت

I wanted to replace the letter ة with another letter ه

Now I used this

Update MyTable
SET MyColumn = Replace ( MyColumn, N'ة' , N'ه' )

But ended with replacing every letter that has ة or ت to be replaced with ه

How can I tell SQL Server to replace only ة Not ت ?

Questioner
asmgx
Viewed
0
Dan Guzman 2020-11-29 10:26:47

Specify a COLLATE clause with a binary collation to use the code points of the exact characters to be searched/replaced:

UPDATE dbo.MyTable
SET MyColumn = REPLACE( MyColumn COLLATE Arabic_BIN, N'ة' COLLATE Arabic_BIN, N'ه' COLLATE Arabic_BIN);