Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
Can anyone help to converting following sql to T-SQL?
SELECT * FROM ( SELECT LEVEL n, TO_DATE ('31/12/2010', 'DD/MM/YYYY') + NUMTODSINTERVAL (LEVEL, 'day') CurrDate FROM DUAL CONNECT BY LEVEL <= 2000);
This should do the trick, I think
select dateadd(d, number, '2010-12-31') from master..spt_values where type='p' and number between 1 and 2000
Add a comment
nevermind... found it...
with n as ( SELECT TOP (DATEDIFF(DAY, '2010-12-31', '2015-12-31') + 1) n = ROW_NUMBER() OVER (ORDER BY [object_id]) FROM sys.all_objects ) SELECT DATEADD(DAY, n-1, '2010-12-31') FROM n;
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.