Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)

  • RE: Delete old Backup files using T-sql script

    Do not use mapped drive path, use UNC path.

  • RE: Delete old Backup files using T-sql script

    This is how I keep backup for seven days:

    Use Master

    Declare

    @new_device nvarchar(40),

    @new_file nvarchar(40),

    @old_device nvarchar(40)

    set @new_device='MyDB'+convert(char(8),getdate(),12)

    set @new_file='d:\mssql\BACKUP\MyDB'+convert(char(8),getdate(),12)

    set @old_device='MyDB'+convert(char(8),(getdate()-7),12)

    EXEC sp_addumpdevice 'disk',@new_device,@new_file

    BACKUP DATABASE MyDB TO @new_device

    If exists (Select name from sysdevices

    ...

Viewing 2 posts - 1 through 2 (of 2 total)