Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2003

    Unanswered: Bulk Insert from Network Drive


    I am trying to create a stored procedure to import data from a text file on a periodic basis into a table. The text file is generated monthly and has the month and year as part of the file name (e.g. 2003-10-01.dat). The text file resides on a network drive.

    Is there a way to import this data using the BULK INSERT command? I have tried several variants but I am not successful when trying to run my stored procedure against the text file on the network drive. I get an 'Operating system error code 5(Access is denied.)' error.

    What settings/security permissions (and where do I find those settings) do I need to check to provide sufficient access?

    Also, is this task better done through a DTS package?


    Sammy Lakshmanan

  2. #2
    Join Date
    Jul 2003
    The Dark Planet
    You will need to map the network path as a drive and then execute the procedure. There should be read only permissions for the file.
    Get yourself a copy of the The Holy Book

    order has no physical Brett in The meaning of a Kaiser . -database data

  3. #3
    Join Date
    Nov 2003
    I tried that and I seem to have a different problem. I mapped a network drive (X) to the network share. And then in my BULK INSERT statement, I specified the drive letter in the file path:

    BULK INSERT db.dbo.table FROM 'x:\data\2003_10_01.dat' ...

    and I got the error: 'Operating system error code 3(The system cannot find the path specified.)'.

    I checked the file path, even copied it from Query Analyzer into Explorer and the path/file name is accurate.

    I noticed that when I select a BULK INSERT task in DTS, the drives that are listed for the source file are limited to just the physical hard drives.

  4. #4
    Join Date
    Nov 2003
    Christchurch, New Zealand
    it has to be mapped in a manner that your server understands it not that your local machine understands it.

    eg. your server needs it mapped as the X drive if you are going to do it this way. IMO UNC is a much better idea.

    as for the permissions problem you were having. you need to make sure that the SQL Server account has access to the share you are trying to get your file from.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts