SELECT * FROM VALUES
CREATE FUNCTION [dbo].[GetDateRangeShort] (@StartDate datetime, @EndDate datetime)
RETURNS @Res TABLE (Date datetime) AS
BEGIN
;WITH MyEmp (Date, Level)
AS(
SELECT @StartDate, 1
UNION ALL
SELECT DATEADD(dd, 1, Date), Level + 1
FROM MyEmp
WHERE (Date < @EndDate)
)
INSERT INTO @Res (Date) SELECT Date FROM MyEmp OPTION (MAXRECURSION 0);
RETURN
END