How to copy one database into another under MSSQL Server 2005

Looks like a simple task.
I select a database, then rightclick and select backup, then select a target file and backup is successful.

Next  I create a new database, and wishing to import the previously backup database I select "Restore" and then select the file that contains the newly created backup.

Restore won't succeed however, saying that "The backup set holds a backup of a database other than the existing..."

That makes sense, but there must be a way just to copy structure as well asw data to a new database.
yossikallyAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Raja Jegan RConnect With a Mentor SQL Server DBA & ArchitectCommented:
I will continue from your creation of new database.

1. Right click your newly created database.
2. Choose Tasks --> Restore and do the Backup file locations.
3. Click options in the left side pane.
4. Under Restore Options, Click overwrite the Existing Database.
5. In the dropdown list below, if you see the Restore as path, you will be able to see the earlier database's MDF and LDF path.
6. Change the path to your new MDF and LDF path created for your new database.

Click OK and it is done. It will restore without any issues.
0
 
tpi007Commented:
You need to select 'restore over' option in GUI and ensure paths exist on new server.
0
 
tpi007Commented:
Screen grab below. The paths in backup in GUI will be as server where backup from and may need changing if patsh do not exist on new server.
restore.JPG
0
Build your data science skills into a career

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.

 
udaya kumar laligondlaTechnical LeadCommented:
for copying the schema and data  from the database use Microsoft database publishing wizard. this will create a script for the source database objects. run the script on the destination database.
0
 
tpi007Commented:
A simple way would be to use the copy database wizard as below
Copy-Database.JPG
0
 
yossikallyAuthor Commented:
Thanks. Complete and easy to follow.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.