SQL Query To Copy All Data From A Table Into A New Table

Step 1. Create a table or use an existing database table. In our case, we create a Test table in SQL Server using the following SQL query. 
  1. CREATE TABLE Test  
  2. (ID INT,  
  3. FirstName VARCHAR(40),  
  4. LastName VARCHAR(40))  
Step 2. Insert some records to this table. If you already have a database table with data in it, you don't need this step. My table data looks like this:
 
ID FirstName LastName
 
1 Pankaj pandey
2 Rahul Pandey
3 Ramesh Mishra
4 Raja Singh
 
Step 3. We can use an INSERT INTO SQL query to read data of an existing database table and insert into a new table. If there is no database table, the query will create a new table. 
 
Here is the INSERT INTO command: 
  1. Select * into <New Table Namefrom <Existing Table Name>  
Here is our query that will read data from the Test table and insert into a new table called DummyTest. 
  1. SELECT * INTO dummytest FROM Test  
Step 4. Check the results. Run this command:
 
  1. SELECT * FROM dummytest  
I will return exact same data that we have in the Test table. 
 
ID FirstName LastName
1 Pankaj pandey
2 Rahul Pandey
3 Ramesh Mishra
4 Raja Singh