Skip to content

Instantly share code, notes, and snippets.

@celsojr
Last active May 8, 2020 23:52
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 celsojr/eb6e36a69324f5b12a8a1ac58b07c41a to your computer and use it in GitHub Desktop.
Save celsojr/eb6e36a69324f5b12a8a1ac58b07c41a to your computer and use it in GitHub Desktop.
Database restoration snippet for MSSMS
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<_locDefinition xmlns="urn:locstudio">
<_locDefault _loc="locNone"/>
<_locTag _loc="locData">Title</_locTag>
<_locTag _loc="locData">Description</_locTag>
<_locTag _loc="locData">Author</_locTag>
<_locTag _loc="locData">ToolTip</_locTag>
</_locDefinition>
<CodeSnippet Format="1.0.0">
<Header>
<Title>Database restoration</Title>
<Shortcut></Shortcut>
<Description>Restore database</Description>
<Author>Celso Jr</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>FileName</ID>
<ToolTip>File full path</ToolTip>
<Default>file_name</Default>
</Literal>
</Declarations>
<Code Language="SQL"><![CDATA[USE [master]
ALTER DATABASE [PNCQDEV]
SET OFFLINE WITH ROLLBACK IMMEDIATE
GO
RESTORE DATABASE [PNCQDEV] FROM DISK = N'D:\$FileName$.bak' WITH REPLACE
ALTER DATABASE [PNCQDEV]
SET ONLINE
GO
]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment