I have a stored function that returns 1 if the file specified by @Path exists and 0 if it doesn't. This previously worked, but recently it started returning 0 for all files.create function [dbo].[FileExists] ( @Path varchar(500) )returns intasbegindeclare @objFSys intdeclare @Result intexec sp_OACreate 'Scripting.FileSystemObject', @objFSys outexec sp_OAMethod @objFSys, 'FileExists', @Result out, @Path exec sp_OADestroy @objFSys return @Resultend
I tried checking for reported errors with the following, but apparently no error codes are being thrown.exec sp_OAGetErrorInfo @objFSys, @Source out, @Description out
Can anyone suggest a reason this would stop working? And can anyone suggest a better way of doing this for an entire column of Paths?