gpt4 book ai didi

sql-server - 将 Oracle sql "CONNECT BY LEVEL"转换为 T-SQL

转载 作者:行者123 更新时间:2023-12-02 23:46:33 26 4
gpt4 key购买 nike

谁能帮忙把下面的sql转换成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);

最佳答案

我认为这应该可以解决问题

select dateadd(d, number, '2010-12-31') 
from master..spt_values
where type='p'
and number between 1 and 2000

关于sql-server - 将 Oracle sql "CONNECT BY LEVEL"转换为 T-SQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19387046/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com