First, I know using XP_FileExists is not the best solution, and that CLR is advised. This is a short-term solution, and CLR will not be possible at present.
I have entitled a service account login to run xp_fileexists and xp_cmdshell via a DB Role. The xp_cmdshell works great, but xp_fileexists is not working at all. Do I need to entitle another database object from system DB?
I have an SA level login that works when running XP_FileExists. The service account (standard sql server login) is not working. The proxy account for service account is entitled to access network directory shares.
Any help on this puzzle greatly appreciated. Has me in a spin...
Code:
PRINT 'Check DOS Command DIR of File'
EXEC Master.dbo.xp_cmdshell 'DIR C:\tmuninst.ini'
-- File Does Exist!
PRINT 'Check xp_fileexist'
DECLARE @FileExist INT
EXEC Master.dbo.xp_fileexist 'C:\tmuninst.ini' , @FileExist OUTPUT
IF @FileExist = 0
BEGIN
PRINT 'Error - File Does Not Exist! '
--Always getting error - file does not exist!
END
ELSE
BEGIN
PRINT 'OK - File Was Found.'
END
Steve Medvid
IT Consultant & Web Master