I have a situation where I am checking to see if a file exists before I create a file. I don't want to overwrite an existing file. If the file exists I append an underscore and a sequence number to the file name and then write to the new file.
The problem I have is that when I run the command "EXEC Master.dbo.xp_fileexist" as the sa user, the command returns that the file does exist and all works as expected. Yet, when I run the command as the application user (which uses the proxy account), it returns that the file does not exist so it appends to the existing file.
Anyone know what is missing? Why am I getting different results as different users? When I write to the file, I am using the "EXEC master..xp_cmdshell" command with the bcp command using a proxy account. That works.