1

أرجو المساعدة في جملة استعلام لعرض جميع التواريخ الواقعة بين تاريخين

أرجو المساعدة في جملة استعلام لعرض جميع التواريخ الواقعة بين تاريخين

Eldabbas's avatar
9.1k
Eldabbas
asked 2018-07-04 06:18:54 +0200
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

1

The following query gets all dates between two dates as a table:

with dates as (
SELECT  TOP (DATEDIFF(DAY, '20160101', '20161231') + 1)
        cast(DATEADD(DAY, ROW_NUMBER() OVER(ORDER BY a.object_id) - 1, '20160101') as date) dayDate
FROM    sys.all_objects a
        CROSS JOIN sys.all_objects b
)

select * from dates

Eldabbas's avatar
9.1k
Eldabbas
answered 2018-07-04 06:20:35 +0200
Ahmed Qasid's avatar
5.8k
Ahmed Qasid
updated 2018-07-04 13:21:14 +0200
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments

Your Answer

Login/Signup to Answer