How to backup a SQL Express database in Visual Studio 2010
08 Feb 2011
The easiest way to backup your SQL Express database is use a SQL Management Studio but if you don’t have it installed it is possible to do it from within Visual Studio itself.
- Open up the Server Explorer, right click on the database you wish to backup and select the New Query option to open up a query panel.
- Enter the following T-SQL command in the query panel section (typically the third panel down).
BACKUP DATABASE [C:\USERS\ME\DOCUMENTS\VISUAL STUDIO 2010\PROJECTS\[solution name]\[project name]\APP_DATA\[database file name].MDF]
TO DISK = 'C:\[filename].bak'
- Execute the query and o.k. any warnings regarding issues parsing the command.
The result should be a complete backup of your database to file.