Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Backup with DatetimeStamp

Author  Topic 

jay1
Starting Member

17 Posts

Posted - 2010-08-26 : 10:41:18
Hi All,

I have SQL Servers both 2000 and 2005 and I wanted to perform backups daily, so I want the backups to have Datetime stamp therefore I can distinguish between the different files.
I have 2 questions
1.I'm going to use the following script to run a full backup on the sql 2005 server but I wanted to know if there is a way to perform the same thing in the sql server 2000 server.
declare @CheckDate [nvarchar](50), @Title [nvarchar](100)
set @CheckDate = replace(replace(convert(nvarchar(50),getdate(),120),':',''), ' ', '_')
set @Title = N'E:\DataWarehouse_Microstrategy_'+@CheckDate+''+'.bak'
BACKUP DATABASE [DataWarehouse_Microstrategy]
TO DISK = @Title
WITH NOFORMAT, NOINIT, NAME = N'DataWarehouse_Microstrategy-Full Database Backup',
SKIP, NOREWIND, NOUNLOAD,STATS = 10 ;
2. I need to perform a differential backup for both on sql 2000 and sql 2005 and I wanted to know a way of doing the differential backup but delete files that are old e.g any files that are older then 4 weeks.

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2010-08-26 : 11:08:54
If you want a backup script that will give you everything you need, check out Tara's blog:

http://weblogs.sqlteam.com/tarad/archive/2008/05/21/60606.aspx
Go to Top of Page
   

- Advertisement -