SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 xp_subdirs
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

AskSQLTeam
Ask SQLTeam Question

USA
0 Posts

Posted - 12/17/2004 :  06:44:18  Show Profile  Visit AskSQLTeam's Homepage  Reply with Quote
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.

Regards,
Mala"

spirit1
Cybernetic Yak Master

Slovenia
11749 Posts

Posted - 12/17/2004 :  07:31:19  Show Profile  Visit spirit1's Homepage  Reply with Quote
so let the error be, but disregard it.

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

TimS
Posting Yak Master

USA
198 Posts

Posted - 12/19/2004 :  05:08:22  Show Profile  Reply with Quote
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'

SELECT * FROM #tmp

DROP TABLE #tmp

Tim S
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

USA
4184 Posts

Posted - 12/19/2004 :  17:27:32  Show Profile  Visit derrickleggett's Homepage  Send derrickleggett an AOL message  Send derrickleggett a Yahoo! Message  Reply with Quote
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.

MeanOldDBA
derrickleggett@hotmail.com

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

Mala
Starting Member

26 Posts

Posted - 12/20/2004 :  23:32:59  Show Profile  Reply with Quote
Hi,

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.

Regards,
Mala
Go to Top of Page

TimS
Posting Yak Master

USA
198 Posts

Posted - 12/21/2004 :  09:33:54  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.12 seconds. Powered By: Snitz Forums 2000