sqlserver字符串转为datetime的方法

时间:2015-06-25 19:03:20   收藏:0   阅读:572

源数据为‘yyyymmddhh24miss‘,则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)

 至于其他的形式的,可以参考这个做修改。

原文:http://www.cnblogs.com/docmao/p/4600379.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!