问题描述
我曾尝试创建一个函数来处理表中的unicode / unwanted / invalid字符但是我遇到了一些问题,因为在我的表中还有其他语言/符号/无效出口和数据,如中文,西班牙语,俄语,符号也退出等。
当我使用此功能时,其他语言/符号转换为????
请在这里帮我解决这个问题。
基本上我需要先清理名字和姓氏才能与客户共享数据。
名字结果
♥8إζآس?????????
ندا???
محمدحسن???????
JEAN-LUC JEAN-LUC
我是
MM-almoneef MM-almoneef
برآءه?????
الحر????
غلا?? ?
وديان?????
我尝试了什么:
I have tried to create a function to handle the unicode/unwanted/invalid character in the table but i am getting some issue there because in my table have also other languages/symbol/invalid exits and data like Chinese,Spanish,Russian,symbol also exits etc.
When i am using this function then other languages/symbol converted into ????
please help me here for the issue.
Basically i need this to clean first name and last name before to share data with clients.
First Nameresult
♥๘ إ ζـسآآس?????????
ندا ???
محمد حسن ???????
JEAN-LUCJEAN-LUC
I's Is
MM-almoneefMM-almoneef
برآءه ?????
الحر ????
غلا ???
وديان ?????
What I have tried:
CREATE FUNCTION dbo.UDF_Removecharacter
(
@string VARCHAR(8000)
)
RETURNS VARCHAR(8000)
AS
BEGIN
DECLARE @IncorrectCharLoc SMALLINT
SET @IncorrectCharLoc = PATINDEX('%[^0-9A-Za-z一个-同-]%', @string)
WHILE @IncorrectCharLoc > 0
BEGIN
SET @string = STUFF(@string, @IncorrectCharLoc, 1, '')
SET @IncorrectCharLoc = PATINDEX('%[^0-9A-Za-z个-同-]%', @string)
END
SET @string = @string
RETURN @string
END
推荐答案
这篇关于如何删除first_name中存在的unicode / symbol / invalid charcters的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!