Declare @Hours Table (Hour int); Declare @i as int; Set @i = 5 While @i < 24 Begin Insert into @Hours Values(@i); Set @i = @i + 1; End;
WITH hourscte AS( SELECT 5 Hour UNION ALL SELECT Hour + 1 FROM hourscte WHERE Hour < 24 ) SELECT * FROM hourscte OPTION (MAXRECURSION 0)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)