I have two nearly identical tables (without PK I believe), each has slightly different data in, but in the same format.
How do I insert all the data from one table onto the end of the other table? Thus creating one giant table.
Each table has millions of rows.
I have been trying various combinations of
INSERT INTO os5birm
SELECT *
FROM os50birm
but I keep getting the following error message:
Msg 213, Level 16, State 1, Line 1
Column name or number of supplied values does not match table definition.
The two tables are formatted as follows:
And the data inside is as follows:
Cheers!
CodePudding user response:
Your issue is that you are trying to insert the computed value ogr_geometry
into the computed column of the same name, and you can't insert into computed columns. The solution, which you should really be doing anyway (Bad Habits to Kick : Using SELECT * / omitting the column list) is to explicitly list the columns you are selecting, and the columns you are inserting to:
INSERT INTO os5birm (Column1, Column2, Column3)
SELECT Column1, Column2, Column3
FROM os50birm;