34,575
社区成员
发帖
与我相关
我的任务
分享
SELECT CASE WHEN ISDATE('2010-02-30')=1 THEN '有效日期' ELSE '无效日期' END
--------
无效日期
(所影响的行数为 1 行)
--貌似这样就可以了
select *
from ta
where isdate(rq)=1
and datediff(year,rtrim(cast(rq as datetime)),'2010-09-07')>=50
--try
select *
from ta
where id in (
select id from ta where isdate(rq)=1)
and datediff(year,rtrim(cast(rq as datetime)),'2010-09-07')>=50
and isdate(rq)=1
declare @s varchar(20)
set @s ='2010-02-30'
if isdate(@s) =1
print '是有效时间格式'
else
print '不是有效时间格式'