递归时间计算[英] recursive time calculating

问题描述

我想在 sql server 数据库中输入一个时间并开始以递归形式计算时间
例如输入时间 05:23:34 并开始计算直到 00:00:00
有人帮我吗?

推荐答案

DECLARE @timeval AS DateTimeSET @timeval ='05:23:34'DECLARE @Timetbl as table (tmval datetime)While @timeval <>'00:00:00'开始INSERT INTO @TimetblSELECT @timevalSET @timeval=DateAdd(ss,-1,@timeval)结束INSERT INTO @TimetblSELECT @timeval选择 * 来自 @Timetbl


本文地址:https://www.itbaoku.cn/post/1394914.html