check file exist on Server from SQL Query
use
Usage: EXECUTE xp_fileexist <filename> [, <file_exists INT> OUTPUT]
Usage: EXECUTE xp_fileexist <filename> [, <file_exists INT> OUTPUT]
OR Create a function like so:
CREATE FUNCTION dbo.fn_FileExists(@path varchar(512))
RETURNS BITAS
BEGIN
DECLARE @result INT
EXEC master.dbo.xp_fileexist @path, @result OUTPUT
RETURN cast(@result as bit)
END;
GO
Edit your table and add a computed column (IsExists BIT). Set the expression to:
dbo.fn_FileExists(filepath)
Comments
Post a Comment