SQL Server: Clone a database with all its objects
A previous post covered the steps to copy table structure and data to a new or existing database.
To copy all the objects (tables, users, constraints, etc.) from one SQL Server database to another database, use the Generate Scripts function in SQL Server Management Studio.
-
In the Object Explorer, right click the name of the database. Select Tasks > Generate Scripts…
- The Script Wizard will open. Click Next.
- Select the source database. If you want to copy ALL objects, make sure Script all objects in the selected database is checked. If the box is not checked, you will get a chance to choose the objects you want to include later.
Click Next.