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 anot开发者_运维问答her 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
精彩评论