Saving a SQL Server database to a file and opening it on another server under any database name
Backup and restore are the simplest/safest ways to do this. There are a couple of things that you need to watch out for, or you'll get errors like the one you're seeing now.


SQL Server will default to restoring the files to their original physical locations. If you're restoring to a different server, or a different database name, these paths probably aren't correct. You will have to specify the correct new database name, and file locations (WITH MOVE...).
If you're overwriting an existing database, you'll need to tell SQL Server that you specifically intend to do this (WITH REPLACE). This is a safety feature; don't get into the habit of blindly using this option unless you know you need it.


The restore GUI tool in Management Studio supports both of these options.

To specify the name of the database you want to restore as, go to the "General" page, and enter the correct name in the "Database" field (under the "Destination" subhead).

To specify where you want the database files to be restored to, go to the "Files" page, and specify the new paths in the "Restore As" column.

If you're overwriting an existing database, you'll need to go to the "Options" tab and check the "Overwrite the existing database" option.

If this is a procedure you plan to repeat regularly, you can generate a script for the RESTORE command by clicking the "Script" button on the Restore Database window toolbar.