Search code examples
sql-serverunicodesqltransaction

SQL Server: Replace Arabic Character in Select Statement


I would like to replace Arabic character in select statement with another Arabic character in SQL server, example query:

select replace(ArabicName, 'أ', 'ا') as ArabicName from dataIndividual;

But it does not replace, the reason probably that SQL server does not read the character as Unicode but as ASCII (I guess).

Is there a way to pass a Unicode characters for replace function?

Note: I already tried collate after the Arabic character.


Solution

  • Prefix your string with N

    select replace(ArabicName, N'أ' , N'ا') as ArabicName 
    from dataIndividual;