In order to copy tables from the Test database to the Test1, we can use the Select into SQL statement. This statement will create the tables in the destination database first, then it will copy the data to these tables. If you manage to copy the database objects like indexes and constraints, you need to generate script for it individually, after that you need to apply the scripts to the destination database.
In our example, to copy the Department, Employee, EmployeeDepartmentHistory and EmployeePayHistory tables under the HumanResources schema from the Test database to the Test1 database, we will run the below script:
You can copy table from one database to another by:
For eg: The tables that to be copied from source database to destination one are: Department , Employee , EmployeeDepartmentHistory and EmployeePayHistory under the HumanResources schema.
Create schema HumanResources
Select * into Test1.HumanResources.Department from
Select * into Test1.HumanResources.Employee from
Select * into Test1.HumanResources.EmployeeDepartmentHistory from
Select * into Test1.HumanResources.EmployeePayHistory from