Gloom
Gloom

Reputation: 39

Combining Select Into and Alter table

How to combine Select Into and Alter Table (ms access sql):

SELECT table1.field1
INTO table2
FROM table1;

And second one:

ALTER TABLE table2 ADD COLUMN ID autoincrement;

I was trying UNION ALL but I got message 'action query can't be used as row source'. Is it possible to combine them using different syntax?

Upvotes: 0

Views: 2999

Answers (1)

Rubens Farias
Rubens Farias

Reputation: 57946

You can't mix Data Manipulation Language (DML) with Data Definition Language (DDL).

You'll need to execute both statements separately, or to create a stored procedure which contains both commands.

Upvotes: 1

Related Questions