Bulkinsert error

  • I used code below to insert txt file to a table from local drive but got an error said

    Cannot bulk load because the file "d:\order.TXT" could not be opened

    BULK INSERT #tableOrder

    FROM 'd:\order.TXT'

    If I change to url it works.

    BULK INSERT #tableOrder

    FROM '\\order\order.TXT'

    How to fix it to load txt data from local drive?

  • Hi,

    the account who started the sql-server / sql-server-agent, has this account rights to the file/folder, or only to the share?

    Kind regards,

    Andreas

  • This admin account (sa)

  • adonetok (2/17/2016)


    I used code below to insert txt file to a table from local drive but got an error said

    Cannot bulk load because the file "d:\order.TXT" could not be opened

    BULK INSERT #tableOrder

    FROM 'd:\order.TXT'

    If I change to url it works.

    BULK INSERT #tableOrder

    FROM '\\order\order.TXT'

    How to fix it to load txt data from local drive?

    Is that file on the D: drive on the server?

    If it's on your own workstation, then SQL Server will definitely not see it. SQL Server does not run on your workstation, it runs on its own server.

    Also check that the service account used to run the SQL Server service (which you can find in the configuration tool) has permissions to read the file.


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/

  • D is in local drive.

    Your answer help me.

    Thank you.

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

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