I have some values in table which text contains A«
instead of ë
How to replace those characters with ë
in SQL ?
I tried with
SELECT *
FROM [dbo].[Table]
WHERE [dbo].[Table].CustomValue LIKE '%A«%'
How to update those items in query ?
I have some values in table which text contains A«
instead of ë
How to replace those characters with ë
in SQL ?
I tried with
SELECT *
FROM [dbo].[Table]
WHERE [dbo].[Table].CustomValue LIKE '%A«%'
How to update those items in query ?
An UPDATE
statment with the REPLACE
function should do the trick.
UPDATE [dbo].[Table]
SET CustomValue = REPLACE(CustomValue, 'A«', 'ë')
WHERE CustomValue LIKE '%A«%'
If you want just to SELECT
the data then
SELECT *, REPLACE(CustomValue, 'A«', N'ë')
FROM [dbo].[Table]
WHERE [dbo].[Table].CustomValue LIKE '%A«%'
If you really needs to UPDATE
the data then
UPDATE [dbo].[Table]
SET CustomValue = REPLACE(CustomValue, 'A«', N'ë')
WHERE [dbo].[Table].CustomValue LIKE '%A«%'
Maybe you are looking just for
update dbo.table
set customvalue = replace(customvalue, 'A«', 'ë')
where customvalue like '%A«%';
But maybe your collation does not allow the character 'ë'. In that case you'd have to change the column definition first. E.g.
alter table dbo.table
alter column customvalue nvarchar(1000) collate latin1_general_cs_as;