Lets see how to copy an existing table to new table in SQL Server. There are two options. They are
- Copy only the structure of an existing table into new table
- Copy only the structure with data of an existing table into new table
Copy only the structure of an existing table into new table:
SELECT * INTO tblNew FROM tblOld WHERE 1=2
The above query will copy the structure of an existing table(tblOld) into the new table(tblNew).
Copy only the structure with data of an existing table into new table:
SELECT * INTO tblNew FROM tblOld
This is also same like the previous query, but it copies the structure of existing table(tblOld) with data as well into the new table(tblNew).