I'm trying to generate a big table of consecutive numbers in MySQL.
I just want 2 columns; a primary key and a numbers column with a range of 0-X, where X is very large. Approx. 64,000 rows should do it. I've tried this code with no success:
CREATE TABLE numbers (
number INT NOT NULL
CONSTRAINT XPKnumbers
PRIMARY KEY CLUSTERED (number)
)
INSERT INTO numbers (number) VALUES (0)
DECLARE @i INT
SET @i = 20
WHILE 0 < @i
BEGIN
INSERT INTO numbers (number)
SELECT number + (SELECT 1 + Max(number) FROM numbers)
FROM numbers
SET @i = @i - 1
END
SELECT * FROM numbers
and I get this error:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CONSTRAINT XPKnumbers PRIMARY KEY CLUSTERED (number) ) INSERT INTO n' at line 3
Anybody have any suggestions to make this work?