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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 backup with date

Author  Topic 

bharath63
Starting Member

14 Posts

Posted - 2008-12-18 : 11:58:16
Hi guys,

I want to write a backup script where the filename contains todays date.

Thanks

BHARATH

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2008-12-18 : 13:32:51
Do you have a specific question?

Perhaps this will help:

declare @destination varchar(200)
set @destination = 'c:\my_backups\MyDB_' + convert(varchar, getdate(), 112)
backup database myDB to disk = @Destination


Be One with the Optimizer
TG
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2008-12-18 : 14:46:35
You can look at the stored procedure in this blog entry to see an example. Our you can just use that procedure, since it does what you want.
http://weblogs.sqlteam.com/tarad/archive/2008/08/19/Backup-SQL-Server-Databases.aspx

CODO ERGO SUM
Go to Top of Page

bharath63
Starting Member

14 Posts

Posted - 2008-12-18 : 16:07:01
Thanks Guys.. TG script must fix my problem for time being.. I was facing issue with maintenance task.. so will be scheduling the job with script :-)

BHARATH
Go to Top of Page
   

- Advertisement -