INSERT INTO ... SELECT ..., , . , , SELECT.
Insert into existingTable ( Column1, Column2, Column3, ... )
Select 1, Column2, Column3
From tableName
Where ....
, SELECT . , .
, dest, INSERT, identity_insert '.
, SELECT ... INTO ...
Select 1 as Column1, Column2, Column3
Into newTable
From tableName
Where ....
Again, the selection can be arbitrarily complex, but since the column names are taken from the select statement, all columns must have explicit names. This syntax will give an error if the table "newTable" already exists. This form is very convenient if you want to make a quick copy of the table in order to try something.
Sweko source
share