A databasesnapshot is a point in time view of a given database. Imagine that you have the Adventureworks database and you want to have a view of the database pr. one given date and time. In that situation you want a database snapshot of the Adventure works database.
The syntax is:
Create database adventureworks_yyyymmdd on
as snapshot of adventureworks
What you have created now is a databasesnapshot that you can query like all other ‚Äúdatabases‚ÄĚ, the only difference is that the size of this database is 0.
When you create a snapshot, then it is empty until a page is changed. Before a page is changed, then the original page is moved to the snapshot and then the page is changed.
So when you query a snapshot, then the query first check if a page is changed since the snapshot. If so, then it is taken from the snapshot, otherwise it is taken from the original databasefile.