If you trying to restore a database and getting below error

Error 3154: The backup set holds a backup of a database other than the existing database.

then you can use WITH REPLACE like below:


RESTORE DATABASE [KK_DB] FROM DISK='C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Backup\KK_DB_07252016.bak'
WITH REPLACE

If you have Password with your backup file then use below command:


RESTORE DATABASE [KK_DB] FROM DISK='C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Backup\KK_DB_07252016.bak'
WITH REPLACE, PASSWORD = 'MyPassword'
Advertisements