麻烦详细说一下每条语句的意思!
declare @n as bigint;
set @n=1000000;
with Base as
(select 1 as n union all
select n+1 from Base where n<ceiling(sqrt(@n))
),
expand as
(
select 1 as c
from Base as B1,Base as B2
),
Nums as
(
select  row_number() over(order by c) as n
from expand
)
select n from Nums where n<=@n
option (maxrecursion 0)