sql 查询 非 时间类型的字段

来源:百度知道 编辑:UC知道 时间:2024/06/23 23:27:16
数据字段类型用varchar(10) 里面存的是时间,比如2009-08-05

但是现在数据库里面被插入了一些非时间的数据,比如200905-06

我现在该怎么才能找出这些非时间类型的数据呢??

谢谢指教

select * from table where substring(字段,5,1)<>'-' --SqlServer用法
select * from table where substr(字段,5,1)<>'-' --Oracle用法

以上,希望对你有所帮助!

可以用长度判断,因为非时间数据一般长度不足10,

select * from 表名 where len(字段名)<10