Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XP_FileExists - Not Working Under Different Login with Custom DB Role to Entitle Object?

Status
Not open for further replies.

smedvid

MIS
May 28, 1999
1,228
US

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top