有没有判断是否为integer的函数

解决方案 »

  1.   

    declare @a numeric(20,6)
    set @a=123.45
    if isnumeric(@a)=1 and charindex('.',rtrim(@a))<=0
    print 'Integer'
    else
    print 'Not a Integer'/*
    Not a Integer
    */
      

  2.   

    if patindex('要判断的字符', '[^0-9]')=0 and isnumeric('要判断的字符')=1
       print '是整数'
      

  3.   

    select Convert(int,125.06),125.06
    where Convert(int,125.06)=125.06select Convert(int,125),125
    where  Convert(int,125)=125把原来的数 转化成整数然,如果和原来的数相等就是整数,不等就不是整数
      

  4.   

    一楼的有点问题;
    declare @a numeric(20,6)
    set @a=123print convert(varchar(10),charindex('.',rtrim(@a)))/*
    4
    */
      

  5.   

    沒有直接判斷是否为integer的函数
      

  6.   

    二樓的也有問題:if patindex('125.3', '[^0-9]')=0 and isnumeric('125.3')=1
       print '是整数'
    /*
    結果:
    是整数
    */
      

  7.   

    幫二樓修正一下:
    if patindex('[^0-9]','要判断的字符')=0 and isnumeric('要判断的字符')=1
       print '是整数'