Created
December 6, 2016 18:44
-
-
Save gazlu/9e5418a6c3dc8b03d7a39d7ea364db87 to your computer and use it in GitHub Desktop.
Backup SQL Server localdb database with sqlcmd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sqlcmd -E -S "(localdb)\v11.0" -q "BACKUP DATABASE <DBNAME> TO DISK='<DRIVE>:\<FOLDER_PATH>\<BACKUP_FILE_NAME>.bak'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use "-Q" instead of "-q" to backup and exit sqlcmd. Useful for using in scheduled tasks!
Good to mention that some instances of localdb are connected via "(localdb)\MSSQLLocalDB" instead of "(localdb)\v11.0"