Wednesday, January 1, 2014

Create Dates table as stored procedure

Figured it out



INSERT INTO [DimDate] (
DateKey
,DATE
)
SELECT number_big
,DATEADD(day, number_big, '1900-01-01') AS DATE
FROM numbers_big
WHERE DATEADD(day, number_big, '1900-01-01') BETWEEN getdate()
AND getdate()+50
ORDER BY number_big;
GO


No comments:

Post a Comment