I have table A and table B with same columns, say we have 100 columns. I want to insert the data in table A to table B, I have below insert statement: INSERT INTO B (column1, column2,….) select column1, column2…, column100 from A.
Is there a way I can insert it without list all columns? Thanks!
Unless table B is pretty much identical to table A, listing all of the fields is the only option.
e.g. if they were exact duplicates, with same fields and types, in the same order, then
is all you need. But as soon as there’s a mismatch between the fields, then you’ve got to get dirty and list the fields. This is especially true if B’s fields are different names than what’s in A.