Reputation: 1
I am trying to create a table from another table in MS Access using SQL...
The syntax i am using is
CREATE TABLE
new_table_name AS
SELECT
column1,
column2
FROM old_table;
however, I keep getting a syntax error:
"Syntax error in CREATE TABLE statement".
Anyone can assist me or let me know what I am doing wrong?
Upvotes: 0
Views: 50
Reputation: 31
dim sql as string
sql = "SELECT [column1], [column2] INTO [new_table_name] FROM [old_table]"
DoCmd.RunSQL sql
Upvotes: 0
Reputation: 62318
The only thing close that I can think of is SELECT .... INTO
SELECT column1, column2
INTO new_table_name
FROM old_table;
Note that indexes and extended constraints outside of the type/length constraints will not be included in the new table.
Upvotes: 2