set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
-- =============================================
-- Author: S.Ramesh
-- Create date: 07-05-2006
-- Description: To List list the dates between startdate and end date
-- =============================================
ALTER FUNCTION [dbo].[udf_HierarchyDate]
(
@StartDate DATETIME
, @EndDate DATETIME
)
RETURNS @date TABLE(DATE DATETIME) AS
BEGIN
-- process until startdate is equal to end date
WHILE (@StartDate<=@EndDate)
BEGIN
INSERT INTO @date
SELECT @StartDate
-- increment the date
SET @StartDate = @StartDate+1
END
RETURN
END
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment