create table t
(col varchar(20))insert t
select '6:35' union all
select '12:00'
select cast(case when left(col,charindex(':',col)-1)<10
then '0'+replace(col,':','') else replace(col,':','') end as varchar(6)) as col from tdrop table tcol
------
0635
1200(所影响的行数为 2 行)
(col varchar(20))insert t
select '6:35' union all
select '12:00'
select cast(case when left(col,charindex(':',col)-1)<10
then '0'+replace(col,':','') else replace(col,':','') end as varchar(6)) as col from tdrop table tcol
------
0635
1200(所影响的行数为 2 行)
set @i='6:35'
select stuff(substring(convert(varchar(19),convert(datetime,@i,120),120),12,5),3,1,'')