declare @a varchar(1000),@b varchar(1000)select @a='1999-1-1',@b='34'select isnumeric(@a) 不是数字,isnumeric(@b) 是数字
select isdate(@a) 是时间,isdate(@b) 不是时间

解决方案 »

  1.   

    谢谢大力!
    没想到vb里面的isnumeric和isdate也可以在sql中使用。 :)
    但是还有一点小问题:isdate(2003)返回1,我希望对数字型的值,都判断为非日期型(返回零),有没有办法?
      

  2.   

    大力:
    @b='5100'和@B='51'的时候,判断isdate的结果不同哦。 :)
    我希望对这种形式的输入,一概视为非数字型。
      

  3.   

    还有:
    '3e5'用isnumer判断,是时间,但是我想将这种指数型也看作非数字。
      

  4.   

    select '是数字' where '565' not  like '%[^0123456789]%'
    select '是数字' where '5sd5' not  like '%[^0123456789]%'
      

  5.   

    thanks a lot!
    买单。