The backup set holds a backup of a database other than the existing database (Microsoft SQL Server, Error: 3154)

Long back I took the backup of my development server, Again I am trying to restore it in my own machine or any other machine, I am getting the following error.

“The backup set holds a backup of a database other than the existing ‘sample’ database. RESTORE DATABASE is terminating abnormally. (Microsoft SQL Server, Error: 3154)”

I found very simple solution form Pinal Dave blog.

Run the following commands in SQL

RESTORE DATABASE Sample

FROM DISK =‘C:Sample.bak’

WITH REPLACE