Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

xp_dirtree - permission ok but no results returned Expand / Collapse
Author
Message
Posted Thursday, August 1, 2013 5:47 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, May 13, 2014 12:48 AM
Points: 13, Visits: 18
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 .....

Post #1480221
Posted Thursday, August 1, 2013 5:52 PM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Yesterday @ 10:32 PM
Points: 18,055, Visits: 16,087
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
Post #1480222
Posted Thursday, August 1, 2013 6:17 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, May 13, 2014 12:48 AM
Points: 13, Visits: 18
No spaces and I did not use any special character.
Post #1480224
Posted Thursday, August 1, 2013 8:07 PM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Yesterday @ 10:32 PM
Points: 18,055, Visits: 16,087
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
Post #1480229
Posted Thursday, August 1, 2013 9:15 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, May 13, 2014 12:48 AM
Points: 13, Visits: 18
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.
Post #1480238
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse