开发者

Sql query for inserting all records from one table to another existing table

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜