sqlserver字符串轉爲datetime的方法

源數據爲'yyyymmddhh24miss',則SQL爲sql

CONVERT(datetime, SUBSTRING(opentime,1,4) +'/'+SUBSTRING(opentime,5,2) +'/'+SUBSTRING(opentime,7,2)+' '    +SUBSTRING(opentime,9,2)+':'+SUBSTRING(opentime,11,2)+':'+SUBSTRING(opentime,13,2), 120)

 至於其餘的形式的,能夠參考這個作修改。blog

相關文章
相關標籤/搜索