I'm trying to restore from a database backup to SQL Server 2008. The backup came from a different server. I'm executing the following query:
RESTORE DATABASE Database_Name
FROM DISK = 'C:\Path\To\Backup.file'
WITH REPLACE
GO
If the database does not exist, I'm getting the following error:
Msg 3118, Level 16, State 1, Line 1
The database "Database_Name" does not exist. RESTORE can only create a database when restoring either a full backup or a file backup of the primary file.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
Msg 3118, Level 16, State 1, Line 1
The database "Database_Name" does not exist. RESTORE can only create a database when restoring either a full backup or a file backup of the primary file.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
The file is a full backup.
If the database does exist, I get the following error:
Msg 3154, Level 16, State 4, Line 1
The backup set holds a backup of a database other than the existing 'Database_Name' database.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
Msg 3154, Level 16, State 4, Line 1
The backup set holds a backup of a database other than the existing 'Database_Name' database.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
From what I understand, WITH REPLACEWITH REPLACE
is supposed to be a workaround for this.
I'm stumped.