@A变量是nvarchar型的,我用Isnumeric(@A)来检测变量中的内容是否是纯数字,但是如果@A中的内容为数字后面带字母的形式,如'2bb',用Isnumeric返回的也是1,这种情况怎么解决???

解决方案 »

  1.   

    怎么可能
    我这里测试
    declare @a varchar(100)
    set @a='2bb'
    select isnumeric(@a)
    结果
                
    ----------- 
    0(所影响的行数为 1 行)
      

  2.   

    哦,declare @i nvarchar-----后面忘了指定大小了  ^_^但是又有一个差不多的问题,如下代码:
           declare @Table table (
               MobilePhone varchar(20)
          )
    declare @a intinsert @Table (MobilePhone) values ('1.31123E+13')select * from @Table where isnumeric(MobilePhone)=1
    这里的返回是有值的,象这种现象要怎么解决呢??
      

  3.   

    declare @Table table (
    MobilePhone varchar(20)
    )
    declare @a intinsert @Table (MobilePhone) values ('1.31123E+13')insert @Table (MobilePhone) values ('13222')select * from @Table where MobilePhone not like '%[^0-9]%'
    ------------
    结果:
    MobilePhone
    13222
      

  4.   

    请问like '%[^0-9]%'是什么意思
      

  5.   

    [^] 不属于指定范围 ([a-f]) 或集合 ([abcdef]) 的任何单个字符。 WHERE au_lname LIKE 'de[^l]%' 将查找以 de 开始且其后的字母不为 l 的所有作者的姓氏
      

  6.   

    这个又是怎么回事?
    将 varchar 值 '.362' 转换为数据类型为 int 的列时发生语法错误。