现在的位置: 首页 > 综合 > 正文

从 char 数据类型到 datetime 数据类型的转换导致 datetime 值越界。

2012年09月29日 ⁄ 综合 ⁄ 共 317字 ⁄ 字号 评论关闭
            declare @startRange int 

    select @startRange = count(1)
        from UPM_BIZ.Process.SSC_Sta_WorkTime
        where '2011-10-21 8:20:00'  > convert(datetimeconvert(varchar(10),'2011-10-21 14:20:00'105+ ' ' + [time])
    print @startRange

    

    这段代码在查询分析器里没问题,但是放到函数里就会报我标题写的那个错误,将 convert 函数里的 105 改成 120 就可以了。 

抱歉!评论已关闭.