Sql database restore error

If you are getting following error on restoring database in sql .

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

Then you can try following line of code to restore database from query editor

RESTORE DATABASE TestDb

FROM DISK = 'E:\TestDb.bak'

WITH REPLACE

Second thing is if you do not want to use T-SQL then you need to selection overwrite the existing databse(With replace) option  on restoring database from SSMS

Comments