Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)

Author  Topic 

Ask SQLTeam Question

0 Posts

Posted - 2004-12-17 : 06:44:18
Mala writes "Hi,

I want to check whether the specified path exist in the system from the passing parameter value in a SP. For that I am using xp_subdirs and capturing the output value and raising an error it the return value is not zero. But xpsubdirs also raises sql error is the path doesn’t exist, which I want to suppress.

Can you please tell is there any in-build procedure is there to find out whether the specified path is a valid or not.


Cybernetic Yak Master

11752 Posts

Posted - 2004-12-17 : 07:31:19
so let the error be, but disregard it.

Go with the flow & have fun! Else fight the flow
Go to Top of Page

Posting Yak Master

198 Posts

Posted - 2004-12-19 : 05:08:22
Have you tried the UN-SUPPORTED/UN-Documented xp_fileexist example EXEC xp_fileexist 'c:\winnt'

More complex Example

CREATE TABLE #tmp ([File Exists] BIT, [File is a Directory] BIT, [Parent Directory Exists] BIT)

INSERT INTO #tmp ([File Exists], [File is a Directory], [Parent Directory Exists])
EXEC master.dbo.xp_fileexist 'c:\WINDOWS'



Tim S
Go to Top of Page

Pointy Haired Yak DBA

4184 Posts

Posted - 2004-12-19 : 17:27:32
You could also just use xp_cmdshell 'dir blah/blah/blah.blah' and insert into the temp table like Tim is doing. You then just test the results of the temp table. Then if they drop or change these functions, your stuff still works.


When life gives you a lemon, fire the DBA.
Go to Top of Page

Starting Member

26 Posts

Posted - 2004-12-20 : 23:32:59

Thank you very much. This is what I was looking for. Where will get all the details of Extended and System Sp's which are not documented on Books Online.

Go to Top of Page

Posting Yak Master

198 Posts

Posted - 2004-12-21 : 09:33:54
I got my info from "The Guru's Guide to SQL Server: Stored Procedures, XML and HTML" By Ken Henderson

Tim S
Go to Top of Page

- Advertisement -