源数据为'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)
至于其他的形式的,可以参考这个做修改。
源数据为'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)
至于其他的形式的,可以参考这个做修改。