This short article describes several ways to copy SQL Server tables. The first is the simplest way to copy a table to another table in the same database. What you need to remember is that the table's constraints and indexes are not copied when the table is copied. Here are the code templates and simple ways to use them:
1 Select * into < Table > from < Table > 2 3 Example: 4 Select * into from Employee
We can also copy only certain fields:
1 Select into < Table > 2 from < Table > 3 4 Example: 5 Select into Employee_backup 6 from Employee
The following method copies only the table structure and does not contain data:
1 Select * into <DestinationTable> from <SourceTable> where 1 = 22 3 Example:4 Select * intoEmployee_backup fromEmployeewhere 1=2
The following method copies the table to another SQL Server server:
Select * into < Database Table > from < Database Table > Example: Select * into Mydatabase2.dbo.employee_backup from Mydatabase1.dbo.employee
[Go] How to copy a table of SQL Server