次のSQLは、数値テーブルの生成に使用されるItzikBen-Ganからのものです。そのorder by (select null)
部分はどういう意味ですか?ありがとう。
DECLARE @number_of_numbers INT;
SELECT @number_of_numbers = 100000;
WITH a AS ( SELECT 1 AS i
UNION ALL
SELECT 1
),
b AS ( SELECT 1 AS i
FROM a AS x ,
a AS y
),
c AS ( SELECT 1 AS i
FROM b AS x ,
b AS y
),
d AS ( SELECT 1 AS i
FROM c AS x ,
c AS y
),
e AS ( SELECT 1 AS i
FROM d AS x ,
d AS y
),
f AS ( SELECT 1 AS i
FROM e AS x ,
e AS y
),
numbers
AS ( SELECT TOP ( @number_of_numbers )
ROW_NUMBER() OVER ( ORDER BY ( SELECT NULL
) ) AS number
FROM f
)
SELECT *
FROM numbers;
ありがとう!