DECLARE @dumpfile varchar (50) DECLARE @msg varchar (70) Select @dumpfile = ' d:\ database name. bak ' Select @msg =convert (char), GETDATE (), 9) + '-----cleaning up logs ... ' Print @msg Backup Tran database name with TRUNCATE_ONLY if (@ @ERROR <> 0) Begin Select @msg =convert (char), GETDATE (), 9) + '-----Cleanup log failed or an exception occurred ... ' Print @msg End Else Begin Select @msg =convert (char), GETDATE (), 9) + '-----Cleanup log complete ... ' Print @msg End Select @msg =convert (char), GETDATE (), 9) + '-----Start backing up the Northwind database ... ' Print @msg Backup database name to [email protected] With Init/*init overwrite the existing backup set, do not specify a large amount of data */ if (@ @ERROR <> 0) Begin Select @msg =convert (char), GETDATE (), 9) + '-----backup data failed or unexpected ' Print @msg End Else Begin Select @msg =convert (char), GETDATE (), 9) + '-----Database backup complete ' Print @msg END /* SELECT Mm=datename (yy,getdate ()) +datename (Mm,getdate ()) +datename (Dd,getdate ()) */ |