pape
pape

Reputation: 239

SQL replace č, ć, ž with letter c, z

I've got a table with column Last Name. I want to change a part of strings in the column.

select REPLACE([Last Name],'Ć','s')  FROM myTable1

don't work.

If I put this

select REPLACE([Last Name],'o','s')  FROM myTable1

it is work.

How to change č,ć,ž with another lettter.

Upvotes: 2

Views: 2844

Answers (3)

Ragesh
Ragesh

Reputation: 738

Below query might give the required output :-

select REPLACE([Last Name] COLLATE Cyrillic_General_CI_AI,'Ć','s')  FROM myTable1

Upvotes: 5

Mahesh Bhosale
Mahesh Bhosale

Reputation: 112

Use N' at the start of string containing such strings,

e.g. SELECT 'Ā ā Ă ă Ą ą', N'Ā ā Ă ă Ą ą'

Make the column type nvarchar rather than varchar or nchar for char

For ignore accents use COLLATE clause. E.g.:

SELECT REPLACE([Last Name],'Ć','s') FROM myTable1 COLLATE Latin1_General_CI_AI

Upvotes: 0

Rahul Tripathi
Rahul Tripathi

Reputation: 172418

Try to use the Collation as:

COLLATE  SQL_Latin1_General_Cp1251_CS_AS

So it would be like

select REPLACE([Last Name],'Ć','s')  FROM myTable1
COLLATE  SQL_Latin1_General_Cp1251_CS_AS

Upvotes: 0

Related Questions