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
 Cleanup Task Deleting Everything - T-SQL

Author  Topic 

John_Idol
Starting Member

39 Posts

Posted - 2007-04-24 : 07:27:15
Hi all,

I created a maintenance plan with a cleanup task to delete bak files older than 4 days, but it keeps deleting everything but the current day files.

This is the generated T-SQL:

EXECUTE master.dbo.xp_delete_file 0,N'F:\SQLDBBACKUP',N'BAK',N'2007-04-20T11:59:30',1

Someone can tell what's wrong with it?

I've noticed that wheter if you put the condition on files' age or not it generates exactly the same T-SQL statement, it says that the actual one could be different if you set conditions on the task, but if it is so why they work the saem way?

Thanks!

Cheers,

Giovanni

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-04-24 : 09:42:05
Is it sql2k5? You applied sp2? Original sp2 has problem in file cleanup, need to apply post sp2 fix.
Go to Top of Page

John_Idol
Starting Member

39 Posts

Posted - 2007-04-24 : 09:49:50
Hi,

thanks for answering.

I have SP2 installed. I installed it recently (KB921896 - version: 9.2.302).

Do you know were I can find this fix file if you think this is the case?

Thanks!
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-04-24 : 10:14:02
You can download from Microsoft.
Go to Top of Page

John_Idol
Starting Member

39 Posts

Posted - 2007-04-24 : 10:42:10
I found it,
But it describes a different issue (Cleanup interval) than I have (deletes everything but today instead of deleting everything before [tmestamp]).

Anyway I am going to install it, maybe it'll solve it.

Thanks
Go to Top of Page
   

- Advertisement -