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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XP_FILEEXIST

Status
Not open for further replies.

seabra

Programmer
Apr 19, 2005
7
PT
I'm working with xp_fileexist function and it works very well.

My problem is when the files i need to search are something like "aa.cc.extension".

When the filename have more than one point the output is 1 even when the file doesnt exists.

How can i resolve this? Any sugestion?

Thanks
 
I am not noticing the same behavior that you describe. Can you post the code you are using?

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
DECLARE @CAMINHO CHAR(255)
DECLARE @RESULTADO INT

SET @CAMINHO='DIR E:\CIMATRON\COM.RESULTADO.PDF'
EXEC MASTER..XP_FILEEXIST @CAMINHO, @RESULTADO OUTPUT
PRINT @RESULTADO

Even when the file "COM.RESULTADO.PDF" doesnt exists it returns 1
 
try removing the DIR from this line:

SET @CAMINHO='[!]DIR[/!] E:\CIMATRON\COM.RESULTADO.PDF'

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
DECLARE @CAMINHO CHAR(255)
DECLARE @RESULTADO INT

SET @CAMINHO='E:\CIMATRON\COM.RESULTADO.PDF'
EXEC MASTER..XP_FILEEXIST @CAMINHO, @RESULTADO OUTPUT
PRINT @RESULTADO

Sorry, this is the code i'm trying to run, without "DIR
 
that works fine for me

not that it should but does this make a difference?
Code:
DECLARE @CAMINHO CHAR(255)
DECLARE @RESULTADO INT

SET @CAMINHO='E:\CIMATRON\COM.RESULTADO.PDF'
EXEC @RESULTADO =MASTER..XP_FILEEXIST @CAMINHO
PRINT @RESULTADO

Denis The SQL Menace
--------------------
SQL Server Code,Tips and Tricks, Performance Tuning
SQLBlog.com, Google Interview Questions
 
xp_fileexist is an undocumented extended stored procedure. The functionality provided by this stored procedure is actually contained within xpstar.dll

This dll usually exists in the following folder (on the server).
C:\Program Files\Microsoft SQL Server\MSSQL\Binn

According to this knowledge base article ( this dll is updated in a service pack.

So... my question for you is... what version of SQL Server are you using?

If you are unsure, run...
[tt][blue]Select @@Version[/blue][/tt]
and post the results here.

It's possible that you are running a version of SQL Server that is not fully patched (up to date with service packs). I would suggest you look in to this as a possible cause for your problem.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
The problem is the SQL version.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top