the best way to copy a database ? how can i find

2446 views sql-server
-2

When I want to make a copy of a database, I always create a new empty database, and then restore a backup of the existing database into it. However, I'm wondering if this is really the least error-prone, least complicated, and most efficient way to do this?

answered question

Is it SQL Server express edition?

you don't need to create a new empty database, and then restore a backup of the existing database into it. You can simply restore the backup to a new database name. Backup & Restore is the best and most efficient way of doing what you want

Yes. It is the the least error-prone, least complicated, and most efficient way. It is not necessary to create an empty database first though. Also if you use compressed backups it might be faster

1 Answer

12

You can do these steps:

  1. First generate a .sql file consisting of the only the schema of the source database (Right click on database => Generate Scripts => follow the wizard).
  2. In .sql file, replace the database name with a new database name.
  3. Have the data in the database. (Rightclick on source database, import data => datasource and then select the tables for source: )

It also depends whether its SQL Server express edition. Some of the capabilities arent there in express edition.

posted this

Have an answer?

JD

Please login first before posting an answer.