zoukankan      html  css  js  c++  java
  • sql server剔除某列的汉字,函数。

    create function fun_del_chinese
    (@col varchar(1000))
    returns varchar(1000)
    AS
    begin
    declare @returnchar varchar(1000),@len int
    select @returnchar='',@len=1

    while(@len<=len(@col))
    begin
    if(ASCII(substring(@col,@len,1))<122)
    set @returnchar=@returnchar+substring(@col,@len,1)
    set @len=@len+1
    end
    return @returnchar
    end
    go--此函数可以去除sql数据库某列的汉字。

    ========================================================================

    使用函数如下:

    update dbo.异地人员20171201 set 联系电话=t2.联系电话
    from dbo.异地人员20171201 t1,
    (select 身份证号,dbo.fun_del_chinese(联系电话) 联系电话 from dbo.异地人员20171201
    --where len(联系电话)*2!=datalength(联系电话)--排除全部由中文组成字段
    ) t2
    where t1.身份证号=t2.身份证号

  • 相关阅读:
    Counting Stars hdu
    Color it hdu
    steins;Gate
    原根
    3-idiots
    Tree
    洛谷P1352 没有上司的舞会
    洛谷P1131 时态同步
    洛谷P3177 树上染色
    Codeforces Round #617 (Div. 3)
  • 原文地址:https://www.cnblogs.com/hxp-wwx/p/8016335.html
Copyright © 2011-2022 走看看