'SQL Server xp_delete_file parameters
Who can explain list of xp_Delete_file parameters in sql server. I don't find msdn document for this stored procedure.
I got script of xp_Delete_file from maintenance plan but didn't understand first parameter.
Solution 1:[1]
Following on from the comment above, I have been testing this on SQL Server 2012 SP4 and I can confirm the syntax EXEC master.dbo.xp_delete_file 0, 'C:\Some Path\Backup file.bak' works and deletes the specific named file.
Solution 2:[2]
I found this to be more obvious, since I like showing parameters:
DECLARE @DeleteDate DATETIME = DATEADD(wk,-2,GETDATE());
DECLARE @ReturnVal int
EXEC @ReturnVal = master.dbo.xp_delete_file
@FileType = 0,
@FolderPath = N'U:\SQLBackups',
@FileExtension = N'bak',
@Date = @DeleteDate,
@Subfolder = 1
print @ReturnVal
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ubercoder |
| Solution 2 | Andre Q |
