3 Ocak 2012 Salı

date range with recursive cte

WITH

DATE_RANGE as (

      SELECT

            [date]=GETDATE()

       UNION ALL

       SELECT DATEADD(day,1,[date])

       FROM DATE_RANGE

      WHERE DATEADD(day,1,[date])<=DATEADD(day,10,GETDATE())

)

SELECT * FROM DATE_RANGE

 

image

Hiç yorum yok:

Yorum Gönder