| Comment | SQLServer User-Defined Function
PURPOSE
Check if file exists.
Return value (BIT):
0 (False) - File does not exist
1 (True) - File exists
EXAMPLES
SELECT dbo.fun_FileExist('C:\Windows\system.ini')
1
SELECT dbo.fun_FileExist('C:\xxxx.txt')
0
-- IIF is available starting with SQL Server 2012
SELECT IIF(dbo.fun_FileExist('C:\Windows\system.ini')=1,'Yes','No')
Yes
HISTORY
2015-11-24 - Created function
2024-02-09 - Changed history table
2026-01-23 - Changed return value type to BIT
2026-03-30 - Changed examples
TAGS
<program>
<description>Check if file exists</description>
<generic>1</generic>
<author>Gerrit Mantel</author>
<created>2015-11-24</created>
<lastmodified>2026-03-30</lastmodified>
</program> |