September 19, 2012 at 2:31 pm
Why is the following statement not deleting the backup files?
EXECUTE master.dbo.xp_delete_file 0,N'D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\master',N'.bak',N'2012-09-12T16:25:36',1
It finishes without error, in a second, but there are still files with the .bak at that file path.. dating back to Jan 2011.. when we loaded SQl on to this box.
September 19, 2012 at 4:00 pm
dwilliscp (9/19/2012)
Why is the following statement not deleting the backup files?EXECUTE master.dbo.xp_delete_file 0,N'D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\master',N'.bak',N'2012-09-12T16:25:36',1
It finishes without error, in a second, but there are still files with the .bak at that file path.. dating back to Jan 2011.. when we loaded SQl on to this box.
Probably because of the "." in the N'.bak' string. This is probably being done through a maintenance plan, and you don't include the "." when providing the extension for the file names.
September 19, 2012 at 4:26 pm
September 20, 2012 at 6:37 am
Thanks Lynn, that was the problem... darn I did not even think anything when I read the T-SQL.. you were right that they created this as a maintenance plan. Interesting that our non-system databases are all done using stored proc's but the system ones use maintenance plans.
September 20, 2012 at 6:41 am
ThomasRushton (9/19/2012)
Ah, the joys of using undocumented stored procedures...Note that there's a "feature" in the SQL2005 RTM version of that xp too - it won't traverse subdirectories, as I found a few years ago[/url]... Pimping myself? Surely not... :Whistling:
Well we are running 2005 but it is deleteing files at least one level down.. from the backup directory. 😉
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply