Paste in with select * select does not work

If tables A and B have the same structure (except for the ID field). In A, it is assigned automatically, but in B it expects a value from the insert.

How can I do INSERT INTO A (select * from B).

What is the fastest, most flexible SQL that can work in a stored procedure.

+4
source share
1 answer

Specify the columns explicitly:

INSERT INTO TableA (col1, col2) SELECT col1, col2 FROM TableB 
+9
source

Source: https://habr.com/ru/post/1332101/


All Articles