tags:

views:

87

answers:

1

I have the following string

áéíóú

which I need to convert it to

aeiou

How can I achieve it? (I don't need to compare, I need the new string to save)

+7  A: 

Try using COLLATE:

select 'áéíóú' collate SQL_Latin1_General_Cp1251_CS_AS

For Unicode data, try the following:

select cast(N'áéíóú' as varchar(max)) collate SQL_Latin1_General_Cp1251_CS_AS

I am not sure what you may lose in the translation when using the second approach.

RedFilter
+1 - Much better than my nested `REPLACE`
JNK
Only works for non-unicode columns. I.e., will not work for `N'áéíóú'`.
GSerg
@Gserg: good point!
RedFilter
I added an update to address Unicode.
RedFilter