How to insert rows with structure from one table to another table?
What is the query in SQL Server to insert rows with structure from o开发者_运维问答ne table to another table?
A couple ways
SELECT INTO
SELECT
field1,
field2,
...
INTO Table1
FROM Table2
INSERT INTO
INSERT INTO Table1
field1,
field2,
...
SELECT
field1,
field2,
...
FROM Table2
Sounds like you want something like this:
INSERT INTO DestTable (Column1,COlumn2)
SELECT Column1, Column2
FROM SourceTable
Here is the documentation for the INSERT...EXECUTE statement that will allow you to do what you need.
精彩评论