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.
| Author |
Topic |
|
SqlFriend
Starting Member
26 Posts |
Posted - 2004-08-26 : 09:19:34
|
| I want to backup my database with the date in the filename. When I try this:BACKUP DATABASE dbProjects TO DISK = 'c:\backup\dbProjects' + GetDate()' + '.dat_bak';It gives me an error incorrect syntax near +Any suggestions?Thanks! |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2004-08-26 : 09:32:05
|
| declare @sql nvarchar(1000)select @sql = 'BACKUP DATABASE dbProjects TO DISK = ''c:\backup\dbProjects' + convert (varchar(20),GetDate(),112) +'.dat_bak'''select @sql--exec sp_executesql @sql -- remove comment to execute-------Moo. :) |
 |
|
|
|
|
|