0

Have a table of customers with accented letters, I need to replace them with the same letter without the accent, I can use the REPLACE feature, but my problem is that I have some clients in upper case and some in lower case and I need keep uppercase and lowercase

Kamil Gosciminski
  • 16,547
  • 8
  • 49
  • 72
Mike Tex
  • 1
  • 1

1 Answers1

1

As suggested in comments, your expected result could be achieved using REPLACE() function.

If you need to preserve upper and lower case letters, then write explicitly replace functions for both cases AND change the collation to case-sensitive one: Latin1_General_CS_AS.

Here is the related post on using this collation for case sensitive search. and a quote from it:

Adding COLLATE Latin1_General_CS_AS makes the search case sensitive.

Using your example characters from comments, that are in the input below it seems to be working.

Query

SELECT REPLACE(REPLACE(REPLACE(REPLACE('áÁéÃ' COLLATE Latin1_General_CS_AS, 'á','a'),'Á','A'),'é','e'),'Ã','A')

Input: áÁéÃ

Output: aAeA

Check SQL Fiddle to view the example in action.

Kamil Gosciminski
  • 16,547
  • 8
  • 49
  • 72