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 |
|
nitin1353
Constraint Violating Yak Guru
381 Posts |
Posted - 2010-01-19 : 12:01:58
|
| Gurus,I was looking at xp_cmdshell options, the backup file name in my folder is some thing like testdb201001192130.bak i.e <nameofthedb><year><month><date><time>.bak. Now if today is 19th jan and i want to delete files of 18th and 17th and if i try something like select @dt=getdate()-2 ,how will this work with the naming convention of my .bak files?Nitin |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
nitin1353
Constraint Violating Yak Guru
381 Posts |
Posted - 2010-01-20 : 10:22:45
|
| Tara,I did something like this"declare @dt datetimeselect @dt=getdate()-2 --No days to deleteEXECUTE master.dbo.xp_delete_file 0,N'D:\restoredb',N'BAK',@dt"now if i want to implement the same thing for copy, i meant i want to copy the last two days data only.Please suggestNitin |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|
|