这是要去除字段中的大小写英文、数字、特定符号
函数如下:
Create Function [dbo].[RemoveCharacters](@Temp VarChar(1000)) Returns VarChar(1000) AS Begin Declare @KeepValues as varchar(50) Set @KeepValues = '%[a-z,A-Z,0-9,%,/,=,-,#,,,:,;]%' While PatIndex(@KeepValues, @Temp) > 0 Set @Temp = Stuff(@Temp, PatIndex(@KeepValues, @Temp), 1, '') Return @Temp End
调用方法
Select dbo.RemoveCharacters('这是AB中文abv的0,1范例223')