xp_dirtree to access UNC folder on another file server (+ provide UserId& Pwd)

  • Dear,

    After looking at several options, (I have to read files from a file server to populate a DB), I would like to use xp_dirtree to access a unc folder. I have to provide User Id & pwd in order to be able to read the folder.

    How can I achieve this ?

    Tks.

  • Skip xp_dirtree and use a CLR function for this. VB.NET or C#.NET can easily handle file system tasks, including account and password control.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Tks for your answer.

    I do not use vb.net or csharp....

    Usage of vbs inside stored proc ?

  • You can use CLR in stored procedures and user-defined functions (and user-defined datatypes, even) in SQL 2005 and later. It's not as simple as writing lines of VB.NET inside a T-SQL stored procedure, but it's not particularly complex either. I'm not a .NET dev, but I've written a few CLR stored procedures to do things like test for space available on a network drive before running backups to it. MSDN.com has reasonable documentation on how to do it, and there's a ton of code posted on the internet that you can use for learning how to get things done.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply