CREATE
FUNCTION dbo.fn_FileExists(@path varchar(512))
RETURNS BIT
AS
BEGIN
DECLARE @result INT
EXEC master.dbo.xp_fileexist @path, @result OUTPUT
RETURN cast(@result as bit)
END;
GO
dbo.fn_FileExists(filepath)
DECLARE @isExists INT
exec master.dbo.xp_fileexist 'C:\vishwanath\21776656.docx',
@isExists OUTPUT
SELECT case @isExists
when 1 then 'Yes'
else 'No'
end as isExists
No comments:
Post a Comment