Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Help with SQL replace

Author  Topic 

kma07
Starting Member

3 Posts

Posted - 2010-04-14 : 22:51:13
Hi there,

I have a problem where I need to write some code that can replace unicode characters with normal characters, for example:

Å with A

It needs to scan a database with 2000+ records and replace each unicode character it comes across with a character that's been mapped to it like Å=A

Thanks in advance!

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-04-15 : 03:20:19
You can temporarily change COLLATION, like this
DECLARE	@Sample TABLE
(
Data VARCHAR(40) COLLATE Finnish_Swedish_100_CI_AS
)

INSERT @Sample
(
Data
)
SELECT 'Hej och hå, till gruvan vi nu gå!'

SELECT Data,
DATA COLLATE Cyrillic_General_100_CI_AI
FROM @Sample



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-04-15 : 03:45:33
You can also add this sample data to test with
UNION ALL SELECT 'Å i åa ä e ö.'



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -