select * from m_user where isnumeric(isnull(m_username,'*'))=1

解决方案 »

  1.   

    请问如何在用户名字段中查找只为数字的记录.   
      例:我有一个用户表m_user.用户名(m_username)为用户表里的字段.   
      用户名的记录可能为:abcd,ab123,123.   
      我现在只想查出全为数字的记录.   
      请问怎么写查询语句呢?select * from m_user where ISNUMERIC (m_username) = 1
      

  2.   

    select * from m_user where patindex('%[^0-9]%',username)=0