22,297
社区成员
发帖
与我相关
我的任务
分享


drop table test
create table test (d varchar(30))
insert into test values('2015-02-31')
insert into test values('2015-02-28')
select * from test
select cast(d as datetime) from test where isdate(d)=1
/*
d
------------------------------
2015-02-31
2015-02-28
(2 row(s) affected)
-----------------------
2015-02-28 00:00:00.000
*/
而且我刚才试验了一下,如果在where条件内指定了查询该行,就不会报错了。