Skip to content

Instantly share code, notes, and snippets.

@eramella
Last active July 12, 2016 01:02
Show Gist options
  • Save eramella/99465d1125462096625251594751a510 to your computer and use it in GitHub Desktop.
Save eramella/99465d1125462096625251594751a510 to your computer and use it in GitHub Desktop.
Restore SQLExpress backup to a LocalDb
-check file names first
restore filelistonly
from disk = 'c:\dev\EMS.2016-07-11.bak'
-Then restore filename to a local disk location of your choice (make sure the entire path is already created before running this)
restore database EMS
from disk = 'c:\dev\EMS.2016-07-11.bak'
with move 'EMS' to 'c:\dev\SQLData\EMS.mdf',
move 'EMS_log' to 'c:\dev\SQLData\EMS_log.ldf',
replace;
@eramella
Copy link
Author

Thank you Rob Prouse, he created this, see his blog at http://www.alteridem.net/2016/03/24/restore-a-sql-server-backup-to-localdb/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment