user1372603
user1372603

Reputation: 57

Converting None latin characters into latin charcters in Azure SQL Server

I would like to use a function convert none Latin characters to Latin characters when producing a report from the data in the DB, which is Azure SQL Server. i.e. input the original name and output the name with the latin characters

For example if a name is written with one of the following:

Ä ä À à Á á Â â Ã ã Å å Ǎ ǎ Ą ą Ă ă Æ æ

I would like to replace the non-latin characters with A or a.

If a name is written with one of the following:

Ç ç Ć ć Ĉ ĉ Č č

I would like to replace the non-latin characters with C or c.

This is the list of non-latin characters to replace. It is quite long so I am asking if anyone knows a smart way to do this rather than brute force using so many replace operations:

enter image description here

Thank you for your help.

Upvotes: 0

Views: 1524

Answers (1)

Ravi Desai
Ravi Desai

Reputation: 150

Use COLLATE SQL_Latin1_General_CP1253_CI_AI in your SELECT statements.

For example:

SELECT 'Ä ä À à Á á Â â Ã ã Å å Ǎ ǎ Ą ą Ă ă Æ æ' COLLATE SQL_Latin1_General_CP1253_CI_AI as [result]

It will work for almost all characters specified in your image except few like Æ and æ. You can use TRANSLATE for remaining characters if it is really required.

You can read more from here.

Upvotes: 1

Related Questions