xp_fileexist works differently for different users

  • 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.

    Thank you.

    Tammy

  • Did you get a chance to read this, hope this helps!

    http://www.sqlservercentral.com/articles/Stored+Procedures/xpfileexist/183/

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply