I have a question about SQL Server.
Table Emp
:
Id | Name
-------+-------------------
1 |test“te d'abc
2 |anr¤a
3 | gs-re-C“te d'ab
4 |M‚fe, DF
5 |R™temd
6 |™jad”ji
7 |Cje y ret¢n
8 |J™kl™balu
9 |le“ne-iokd
10 |liode-Pyr‚n‚ie
11 |V„s G”ta
12 |Sƒo Paulo
13 |vAstra gAtaland
14 |¥uble / Bio-Bio
15 |U“pl™n/ds VAsb-y
I need to replace the special characters with empty values.
Based on the above table, I want to output something like below. I tried like this:
select
REPLACE(state, SUBSTRING(state, PATINDEX('%[^"a-z"]%', state), 1), '') as name,
id
from emp
This query doesn't return the expected result.
Output is:
Id | Name
-------+-------------
1 |testtedabc
2 |anra
3 |gsreCedab
4 |MfeDF
5 |Rtemd
6 |jadji
7 |Cjeyretn
8 |Jkbalu
9 |eneiokd
10 |iodePyrnie
11 |VsGta
12 |SoPaulo
13 |vAstragAtaand
14 |ubleBioBio
15 |UpndsVAsby
Please tell me how to write a query to achieve this task in SQL Server.