Showing posts with label sqldmo. Show all posts
Showing posts with label sqldmo. Show all posts

Friday, February 24, 2012

Backup MSDE database

How add backup job schedule MSDE database with sqldmo(vb.net). Freq_type =
daily and file name (.bak and .log) is different for all days.
hi Viktor,
Viktor Zadro wrote:
> How add backup job schedule MSDE database with sqldmo(vb.net).
> Freq_type = daily and file name (.bak and .log) is different for all
> days.
hi Viktor,
as you are doing a scheduled backup job, you should resort on
Transact-SQL...
create your job and job schedules as needed and, regarding the step, add a
T-SQL step with a command that will auto-modify the backup file name at each
execution like
SET NOCOUNT ON
DECLARE @.fName VARCHAR(256)
SELECT @.fName = CONVERT(VARCHAR(19), getdate() , 120)
SELECT @.fName = REPLACE( @.fName , ' ' , '_')
SELECT @.fName = REPLACE( @.fName , '-' , '_')
SELECT @.fName = REPLACE( @.fName , ':' , '_')
SELECT @.fName = 'C:\' + @.fName + '.bak'
SELECT @.fName
BACKUP DATABASE [a] TO DISK = @.fName WITH INIT ,
NOUNLOAD ,
NAME = N'a BackUp',
NOSKIP ,
STATS = 10,
NOFORMAT
that will backup to
C:\2005_01_13_12_50_25.bak
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.9.1 - DbaMgr ver 0.55.1
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply