MS Access:快速创建1000000行的测试表

时间:2014-09-16 13:15:32

标签: sql ms-access

我想在MS-Access 2003中快速创建和插入表,如下所示(仅在SQL Query语句的帮助下):

表名:MyTestTable

==========
MyColName
----------
       1
       2
       3
       4
       5
       6
       .
       .
       .
 1000000    
========

在页面上有一个这样的例子用于MS-SQL Server: http://sqlservice.se/sv/start/blogg/sql-server-performance--death-by-correlated-subqueries.aspx

;WITH cteNums AS
( 
    -- I use this common table expression to create a list of numbers from 1 to 1 000 000 
    SELECT top 1000000 ROW_NUMBER() OVER(ORDER BY o1.object_ID) AS n 
    FROM master.sys.columns o1 
    CROSS JOIN master.sys.columns o2 
    CROSS JOIN master.sys.columns o3 
) 
INSERT INTO table1 (col2) --insert into table1 
OUTPUT INSERTED.col2 INTO table2 (col2) --use the output clause to insert into table2 
SELECT DATEADD(d,n,GETDATE()) -- create dates from the list of numbers 
FROM cteNums;

我想在MS-Access

中创建一个这样的TEMPORARY表

0 个答案:

没有答案