UNC Copy -> Local Drive

Posted on 2004-11-24
Last Modified: 2011-10-03
Dear Experts,

Within SQL Server -- I need to copy from a UNC Share to a Local Drive Path.
Normally I would use xp_cmdshell 'XCOPY \\uncserver\sharename\*.* C:\PATH\'
unfortunatly XCOPY does not support reading from a UNC Share and reports an error of file not found, it does exist.

I can even emulate this by making the UNC share on the local-server itself, anybody know the work around for this ?

I'm open to suggestions...

Thanks All in Advance,

Question by:danblake
    LVL 8

    Accepted Solution

    try this TSQL then

    Declare @sql varchar(8000)
    SET @sql = 'copy \\uncserver\sharename\*.* C:\PATH\*.*'

    EXEC master..xp_cmdshell @sql
    LVL 13

    Author Comment

    That works, so does the XCOPY - -must be getting tired....
    Thanks all.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
    Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
    This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
    Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now