Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

xp_fileexist works differently for different users Expand / Collapse
Author
Message
Posted Wednesday, October 24, 2012 10:51 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, August 26, 2013 9:58 AM
Points: 19, Visits: 71
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
Post #1376591
Posted Tuesday, November 20, 2012 5:17 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, November 28, 2013 10:20 PM
Points: 45, Visits: 309
Did you get a chance to read this, hope this helps!

http://www.sqlservercentral.com/articles/Stored+Procedures/xpfileexist/183/
Post #1386853
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse