请告诉我如何在sql server
中将半空间替换为空格,例如:بیامو to بی ام و
select *
from test
where title like N'%بیامو%'
答案 0 :(得分:0)
我不明白半空间是什么意思。但您可以使用替换功能替换字符。
答案 1 :(得分:0)
获得半空格或隐藏字符或零宽度空格的unicode非常重要, 有时是“8204”,有时是“8203” 在以下示例中,我们通过子字符串获取 unicode 编号,然后将其替换,另一件重要的事情是对我来说整理它仅适用于“SQL_Latin1_General_CP1_CI_AS”
DECLARE @UnicodeReplace NVARCHAR(5) = N'یآ'
-- check that unicode string length is 3,
-- and prove existence of zero-width space character matching unicode 8204
SELECT @UnicodeReplace AS String,
LEN(@UnicodeReplace) AS Length,
UNICODE(SUBSTRING(@UnicodeReplace, 2, 1)) AS UnicodeValue -- it gets you 8204
set @UnicodeReplace = N'یآ' collate Persian_100_CI_AS --+ NCHAR(8204)
-- replace and prove the unicode string length is reduced to 2
SELECT REPLACE(@UnicodeReplace collate SQL_Latin1_General_CP1_CI_AS , NCHAR(8204), ''),
LEN(REPLACE(@UnicodeReplace collate SQL_Latin1_General_CP1_CI_AS , NCHAR(8204), '')) AS Length