Gerrit Mantel
Programs SQL_SCALAR_FUNCTION - fun_DeleteFile

Main program

Namefun_DeleteFile
Type_descSQL_SCALAR_FUNCTION
CommentSQLServer User-Defined Function

PURPOSE
Delete given file(s).

Files which are read_only can not be deleted.

Return value (INT):
0 = Success on delete file(s)
negative integer = Failure on delete file(s)

EXAMPLES
SELECT dbo.fun_DeleteFile('C:\Temp\a.txt');
SELECT dbo.fun_DeleteFile('C:\Temp\*.txt');
SELECT dbo.fun_DeleteFile('C:\Temp\*.*');

HISTORY
2017-10-10 - Created function
2024-02-09 - Changed history table
2026-01-23 - Return retval from DeleteFile

TAGS
<program>
<description>Delete given file(s)</description>
<generic>1</generic>
<author>Gerrit Mantel</author>
<created>2017-10-10</created>
<lastmodified>2026-01-23</lastmodified>
</program>
DescriptionDelete given file(s)
Minversion
Generic1
AuthorGerrit Mantel
Created2017-10-10 00:00:00
Lastmodified2026-01-23 00:00:00
Xp_cmdshell0
Ole_automation1
Subprogram_cnt0
Sourcecode