SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


xp_fileexist works differently for different users


xp_fileexist works differently for different users

Author
Message
tammyf
tammyf
SSC-Enthusiastic
SSC-Enthusiastic (169 reputation)SSC-Enthusiastic (169 reputation)SSC-Enthusiastic (169 reputation)SSC-Enthusiastic (169 reputation)SSC-Enthusiastic (169 reputation)SSC-Enthusiastic (169 reputation)SSC-Enthusiastic (169 reputation)SSC-Enthusiastic (169 reputation)

Group: General Forum Members
Points: 169 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
AJ@SQL
AJ@SQL
SSC Veteran
SSC Veteran (235 reputation)SSC Veteran (235 reputation)SSC Veteran (235 reputation)SSC Veteran (235 reputation)SSC Veteran (235 reputation)SSC Veteran (235 reputation)SSC Veteran (235 reputation)SSC Veteran (235 reputation)

Group: General Forum Members
Points: 235 Visits: 309
Did you get a chance to read this, hope this helps!

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


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search