Skip to content

Instantly share code, notes, and snippets.

@danhaywood
Created September 13, 2017 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danhaywood/1560f8ae51b4a0a76a31c3176e8cd574 to your computer and use it in GitHub Desktop.
Save danhaywood/1560f8ae51b4a0a76a31c3176e8cd574 to your computer and use it in GitHub Desktop.
-- run in the target database
-- (but there must be no other logins using that database otherwise will fail).
declare @sql varchar(max)
set @sql = 'RESTORE DATABASE ' + DB_NAME() + ' FROM DATABASE_SNAPSHOT = ''' + DB_NAME() + '_snapshot'''
use master
select @sql
exec(@sql)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment