日期:2014-05-17 浏览次数:20548 次
create function fn_isdate ( @年 varchar(10), @日期 varchar(20) ) returns varchar(30) as begin if(isdate(@年+'-'+@日期)=1) return convert(varchar(30),cast(@年+'-'+@日期 as datetime),120) else return null return '' end select dbo.fn_isdate('2012','8-1 12:0') /* 2012-08-01 12:00:00 */ select dbo.fn_isdate('2011','13-1 1:2') select dbo.fn_isdate('2012','8-1 70:90') /* NULL */