sql server 去除字符串里面的中文字符
作者:互联网
/* *除去字符串中的中文字符 */ CREATE FUNCTION [dbo].[fn_GSB_DropChinese] (@value varchar(1000)) returns varchar(1000) AS begin declare @returnchar varchar(100) declare @len int select @returnchar='',@len=1 while(@len<=LEN(@value)) begin if(ASCII(SUBSTRING(@value,@len,1))<122) set @returnchar=@returnchar+SUBSTRING(@value,@len,1) set @len=@len+1 end return @returnchar; end
/*
*除去字符串中的中文字符
*/
CREATE FUNCTION [dbo].[fn_GSB_DropChinese]
(@value varchar(1000))
returns varchar(1000)
AS
begin
declare @returnchar varchar(100)
declare @len int
select @returnchar='',@len=1
while(@len<=LEN(@value))
begin
if(ASCII(SUBSTRING(@value,@len,1))<122)
set @returnchar=@returnchar+SUBSTRING(@value,@len,1)
set @len=@len+1
end
return @returnchar;
end
标签:varchar,sql,len,server,value,去除,returnchar,declare,1000 来源: https://www.cnblogs.com/gzb1/p/16562342.html