I am using sql server as my database engine. I need a sql query, so that I can insert all records from one table to another existing table. Both tables are in same DB.
I need to use this query in my code.
insert into destination_table ( field1, field2, field3, ... )
select field1, field2, field3, ...
from source_table
Assuming all of the fields match (are in the same order and of the same type)
INSERT INTO TargetTable SELECT * FROM SourceTable
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With