Home Tsql: CHARINDEX and REPLACE Dosn't recognize special character (Unicode-8207)
Reply: 0

Tsql: CHARINDEX and REPLACE Dosn't recognize special character (Unicode-8207)

user711
1#
user711 Published in June 23, 2018, 9:17 pm

Given the following variable:

declare @str nvarchar(50) = 'a‏bc' 

between 'a' and 'b' there is a hidden character which is: nchar(8207)

therefore:

select len(@str) --4

and:

select unicode(SUBSTRING(@str,2,1)) --8207

my problem is that I have many such records, and I have to find all these characters and delete them.

I'm trying find by CHARINDEX or REPLACE but it just does not recognize this character:

select CHARINDEX(Nchar(unicode(8207)),@str) --0
select REPLACE (@str , Nchar(unicode(8207)), '1') --abc
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.245591 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO