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


xp_dirtree - permission ok but no results returned


xp_dirtree - permission ok but no results returned

Author
Message
davidku
davidku
Valued Member
Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)

Group: General Forum Members
Points: 50 Visits: 59
Hi Gurus,

I am using Windows Authentication and Trusted Connection when I connect to SQL Server.

I have no problem accessing the path and view the files here :
\\mynetworkpath\folder1\

However, when I execute it in a store procedure :

EXEC master.sys.xp_dirtree ' \\mynetworkpath\folder1\', 1, 1

No results returned.

To test further, I copied the files to my local drive and it runs perfectly.

EXEC master.sys.xp_dirtree 'd:\folder1\', 1, 1

I checked, the file attribute and it is not hidden nor read only.

Do you have any idea why the file not showing up ?

Thanks .....
SQLRNNR
SQLRNNR
SSC-Dedicated
SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)

Group: General Forum Members
Points: 32028 Visits: 18551
any spaces in the network path?



Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server, MVP


SQL RNNR

Posting Performance Based Questions - Gail Shaw

davidku
davidku
Valued Member
Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)

Group: General Forum Members
Points: 50 Visits: 59
No spaces and I did not use any special character.
SQLRNNR
SQLRNNR
SSC-Dedicated
SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)

Group: General Forum Members
Points: 32028 Visits: 18551
sounds like a permissions issue or possibly a double hop issue

I have been able to repro under the following circumstances
two machines not in a domain
user can access the directories of remote computer (call it computer2) and a specific directory.

however, i cannot add the user of computer1 to computer2 (since they are somewhat unknown by not being in a workgroup or domain) shares or folder permissions.

But the user of computer1 can access all directories via xp_dirtree so long as the path is on computer1


So the next question would be, are the two computers in the same workgroup or domain?



Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server, MVP


SQL RNNR

Posting Performance Based Questions - Gail Shaw

davidku
davidku
Valued Member
Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)

Group: General Forum Members
Points: 50 Visits: 59
It should be from the same domain but that's something I need to double confirm.

I managed to fix this issue by using a dos batch file as an alternative solution. Meaning, I run the entire process on DOS rather than inside SSMS.

1) Move the file from network path to a local drive
2) Run the store procedure using SQLCMD

But, it is interesting to know what happen. I tested it in my DEV machine accessing the shared folder on another computer. No problem at all.

When I moved the script to LIVE server, it doesn't work and not able to pick up any files at all. Initial thought, it could be some server level or database settings that prohibits me from browsing other network directory but I don't recall there are such settings.

Thanks for your ideas.
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