DECLARE @bakfile varchar (@bakfilediff varchar), @pathfull varchar, @pathdiff varchar (50)
Set @bakfile = ' HP ' +convert (varchar), GETDATE (), () + '. Bak ')
Set @bakfilediff = ' Hpdiff ' +convert (varchar), GETDATE (), () + '. Bak '
Set @pathfull = ' c:\bak\ ' [email protected]--Define full standby path
Set @pathdiff = ' c:\bak\ ' [email protected]--Define differential backup path
Backup Database HP to [e-mail protected] with differential--differential backup
Backup Database HP to [e-mail protected] with init-full init used to rewrite the backup device if it takes time to replace (CONVERT (varchar (10,getdate (), 108), ': ', ' ‘)Declare@datevarchar( -),@pathvarchar( -)Set @date=Replace((Replace((Replace((SelectCONVERT(varchar( -),getdate(), - )),'-',"')),"',"')), ': ',"')Select@dateSet@path=' F:\backup\ '+' ERP '+@date+'. Bak 'Select@pathBackupDatabaseéRP toDisk=@path with Init
SQL Server Backup Scripts