将ODBC SQL Covert字符串转换为时间

问题描述 投票:0回答:1

我需要将字符串转换为时间。我有2列,其中一列的日期格式正确,但时间看起来像这样:

Time
_____
061923
060239
134803
135011

前2个字符是小时,后2个字符是分钟,后2个字符是秒。如何将其转换为“ HH:MM:SS”之类的格式?我正在使用进度odbc。

sql odbc progress
1个回答
0
投票

您可以将':'插入字符串并转换为时间:

select cast( (left(col, 2) + ':' + substring(col, 3, 2) + ':' + right(col, 2)) as time)
© www.soinside.com 2019 - 2024. All rights reserved.