Backup MS SQL Express Database
To backup a MS SQL Express database:
Create a .sql file containing the SQL backup command:
1 |
BACKUP DATABASE DBaseName TO DISK='C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Backup\DBaseName.bak'; |
Create a .bat (or .cmd) file to launch the .sql file with SQLCMD:
1 2 3 4 5 |
@echo off c: cd \Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Backup del DBaseName.bak "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqlcmd" -i bak.sql -o bak.log</a> |
Create a “Scheduled Task” to launch the .bat file.