IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'myDatabaseName')
BEGIN
BACKUP DATABASE myDatabaseName TO DISK = 'C:\test\myDatabaseName.bak'
WITH FORMAT, NAME = 'Auto backup by scheduler';
END
-- make sure there is MODIFY access for EVERYONE on the target folder
--repeat this command in Windows Task scheduler everyday / week:
--sqlcmd -S localhost\sqlexpress -E -i"C:\test\autoBackupScript.sql"
No comments:
Post a Comment