By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
declare @sdt smalldatetime = '2019-09-23 00:00:00';
with cte as (
select 1 as i
union all
select i + 1
from cte
where i < 60
)
select i,
dateadd(second,i,@sdt) as sdt,
dateadd(second,i,convert(datetime2(0),@sdt)) as dt0
from cte
where i % 5 = 0
order by i;
i | sdt | dt0 |
---|---|---|
5 | 2019-09-23 00:00 | 2019-09-23 00:00:05 |
10 | 2019-09-23 00:00 | 2019-09-23 00:00:10 |
15 | 2019-09-23 00:00 | 2019-09-23 00:00:15 |
20 | 2019-09-23 00:00 | 2019-09-23 00:00:20 |
25 | 2019-09-23 00:00 | 2019-09-23 00:00:25 |
30 | 2019-09-23 00:01 | 2019-09-23 00:00:30 |
35 | 2019-09-23 00:01 | 2019-09-23 00:00:35 |
40 | 2019-09-23 00:01 | 2019-09-23 00:00:40 |
45 | 2019-09-23 00:01 | 2019-09-23 00:00:45 |
50 | 2019-09-23 00:01 | 2019-09-23 00:00:50 |
55 | 2019-09-23 00:01 | 2019-09-23 00:00:55 |
60 | 2019-09-23 00:01 | 2019-09-23 00:01:00 |