一天内时钟分钟重复的时刻

    技术2022-05-20  62

    declare @TimeResult Table (sTime char(8)) declare @nSecond int, @h int, @m int, @s int, @n int select @nSecond=0, @h=0, @m=0, @s=0, @n=0 while @n<23 begin set @nSecond=Round(720*60*@n/11.0, 0) set @h=@nSecond/60/60 set @m=(@nSecond/60)` set @s=@nSecond`` if @h<24 insert into @TimeResult select sTime=Replicate('0', 2-len(@h))+Cast(@h as varchar(2))+':' +Replicate('0', 2-len(@m))+Cast(@m as varchar(2))+':' +Replicate('0', 2-len(@s))+Cast(@s as varchar(2)) set @n=@n+1 end select * from @TimeResult

    最新回复(0)