删除汉字:
CREATE FUNCTION deleteHz (@cargoname varchar(512))
RETURNS varchar(512)
AS
BEGIN
DECLARE @Result varchar(512)
declare @sno smallint
select @Result=''
select @sno=1
while(@sno<=datalength(@cargoname))
begin
if datalength(SUBSTRING(@cargoname,@sno, 1))=1
set @Result=@Result+SUBSTRING(@cargoname,@sno, 1)
set @sno=@sno+1
end
RETURN(@Result)
END
删除字符:
CREATE FUNCTION deleteEn (@cargoname varchar(512))
RETURNS varchar(512)
AS
BEGIN
DECLARE @Result varchar(512)
declare @sno smallint
select @Result=''
select @sno=1
while(@sno<=datalength(@cargoname))
begin
if datalength(SUBSTRING(@cargoname,@sno, 1))=2
set @Result=@Result+SUBSTRING(@cargoname,@sno, 1)
set @sno=@sno+1
end
RETURN(@Result)
END
删除数据库字段中的汉字或字符
最新推荐文章于 2021-11-08 23:13:10 发布