How to insert all records of a table into a new table in the SQL server?
How to insert all records of a table into a new table in the SQL server?
Jr. Software Developer
I am a software developer at MindStick soft. Pvt. ltd. I joined this company in august 2021 after completing my post-graduation course. I love to see the historical places of my country.
To insert all records of a table into a new table in the SQL server, we can use the INSERT INTO SELECT command.
An example is demonstrated below:
Let the table with the records be:
TABLE1
Our task is to transfer the records from TABLE1 to a new table named TABLE2. We have created TABLE2 and inserted the values into it, as demonstrated below:
Here is the table with the data inserted:
TABLE2