1 USE [master]
2 GO
3 /****** Object: UserDefinedFunction [dbo].[RemoveCharRep] Script Date: 04/06/2016 17:34:54 ******/
4 SET ANSI_NULLS ON
5 GO
6 SET QUOTED_IDENTIFIER ON
7 GO
8 --==============================
9 --过滤掉字符串中中文字符 @s 为输入字符串
10 --==============================
11 CREATE FUNCTION [dbo].[RemoveCharRep](@s varchar(200)) returns varchar(200) as
12 begin
13 declare @i int, @a varchar(1), @s1 varchar(200)
14 set @i = 1
15 set @s1 = ‘‘
16 while @i <= len(@s)
17 begin
18 set @a = substring(@s, @i, 1)
19 if (@a >= ‘a‘ and @a <= ‘z‘ or @a >= ‘A‘ and @a <= ‘Z‘or @a >= ‘0‘ and @a <=‘9‘)
20 set @s1 = @s1 + @a
21 set @i = @i + 1
22 end
23 return @s1
24 end
时间: 2024-10-16 15:28:31