Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
use master
create procedure usp_BackupDatabase
@DatabaseName varchar(100)
as
declare @date varchar(10)
declare @BackupPath varchar(255)
declare @BackupFile varchar(300)
set @BackupPath = [color blue]'d:\Some\Path\'[/color]
set @date = convert(varchar(10), getdate(), 112)
set @BackupFile = @BackupPath + @DatabaseName + '_' + @date + '.bak'
backup database @DatabaseName to disk=@BackupFile
go
create procedure usp_BackupLog
@DatabaseName varchar(100)
as
declare @date varchar(10)
declare @time varchar(10)
declare @BackupPath varchar(255)
declare @BackupFile varchar(300)
set @BackupPath = [color blue]'d:\Some\Path\'[/color]
set @date = convert(varchar(10), getdate(), 112)
set @time = replace(convert(varchar(10), getdate(), 108), ':', '')
set @BackupFile = @BackupPath + @DatabaseName + '_' + @date + '_' + @time + '.trn'
backup log @DatabaseName to disk=@BackupFile
go
sp_MSForEachDB 'master.dbo.usp_BackupDatabase ?'
sp_MSForEachDB 'master.dbo.usp_BackupLog ?'
exec master.dbo.usp_BackupDatabase '{UserDatabaseName}'
robocopy [color blue]d:\some\path d:\TempDelete[/color] /MOV /MINAGE 3
dir /B /S /A-D d:\tempdelete > dellist.txt
@for /f "tokens=1" %%a in (dellist.txt) del %%a /F /Q