SNAPSHOT IN SQL SERVER

Vaishali Goilkar
1 min readJun 9, 2020

In this article, we learn about SQL Server Snapshot.

SNAPSHOT

  • Snapshots are used to create a recent copy of the table.
  • It contains all records or selected records from the table.

SYNTAX OF CREATING SNAPSHOT

CREATE SNAPSHOT <list of options> AS <select query>

Example:-

CREATE SNAPSHOT emp_snap

AS SELECT * FROM employee WHERE id=4

  • To view the records select * from emp_snap query is used.

SYNTAX OF ALTERING SNAPSHOT

ALTER SNAPSHOTS<snapshot_name><option list>

SYNTAX OF DROPPING SNAPSHOT

DROP SNAPSHOTS<snapshot_name>

Example:- DROP SNAPSHOTS emp_snap

If you are a newbie to database learning — SQL Server recommended is the following must-watch video: -

--

--