我需要在存储过程验证手机号码想问大家怎么用的

解决方案 »

  1.   

    --大概这样:
    if patindex('%[1][3-9][3-9]%',TelNo)>0 and
       patindex('%[^0-9]%',TelNo)=0 and
       len(TelNo)=11
    print 'ok'
    else
    print 'ok'
      

  2.   


    create proc p_checkTel
    @tel varchar(20)
    as
    if patindex('[1][3-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]',tel)>0
    print @tel
    else
    print 'Eorro Number'
      

  3.   

    if patindex('%[1][3-9][3-9]%','15010000000')>0 and
       patindex('%[^0-9]%','15010000000')=0 and
       len('15010000000')=11
    print 'ok'
    else
    print 'N'
    显示 'N'