When changing the letter (ي) at the word to the letter (ى) changes and there is no problem, but the problem in changing the letter (ي) in the middles of the letter?
Is there a solution to ignore the middles of the letter?
DECLARE @FullName VARCHAR(100)
SET @FullName = 'عبدالله عيد محمد علي'
Select @FullName, REPLACE(@FullName,'ى ','ي ')
-- عبدالله عيد محمد علي
-- عبدالله عىد محمد على
3条答案
按热度按时间5lhxktic1#
Try using their Unicode equivalents
Such as
With this output
p8h8hvxi2#
You can use a combination of
STRING_SPLIT
,STUFF
andREVERSE
to split the string by spaces and then replace the last occurrence of a character in each word. And then you can useSTRING_AGG
to concatenate back with spaces.NOTE: This will require SQL Server 2017 or higher to work
Also your database seems to use multiple languages so I'd suggest to use
NVARCHAR
instead ofVARCHAR
to support Unicode6mw9ycah3#
You can use the following query, by replacing
[Table_name]
and[Field_name]
with your variables: