Answer the question
In order to leave comments, you need to log in
How to create a script to populate a table of time intervals?
Table TimeSlot
; id, start time, end time
How to make a script that will make 23/24 entries starttime - endtime
0.00-1.00, 1.00-2.00, etc.
Answer the question
In order to leave comments, you need to log in
The corresponding columns are of type TIME
.
DECLARE @I INT = 0
WHILE @I < 24 BEGIN
INSERT [TimeSlot] ([Start Time], [End Time])
VALUES ( CAST( DATEADD( hh, @I, 0 ) AS TIME ), CAST( DATEADD( hh, @I + 1, 0 ) AS TIME ))
SET @I = @I + 1
END
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question