How to restore a database from a snapshot?

We can restore a database from it’s own snapshot only. (That is if we take snapshot of Database 1 on server1, then we can restore Database 1 on server1 only from the snapshot. We can not really use the snapshot even to restore database as a new database (like Database2) on Server 1.

Also you must not have multiple snapshots present for the database while restoring. So you need to delete all other snapshots of the database before restoring.

Use below code:


Note: It is ok if the <SOURCEDATABASE> name or design is changed after the snapshot is taken.