Bulkinsert

  • Please I need assistant. I have a user that want to do a bulk insert from one server to the database on the SQL Server. On the server level, I have made the user a member of Bulk Insert Administrator and also grant the user select, insert and delete on all the table in the database. The bulk insert is failing. What else do I need to do on the SQL Server and the database side? Thank you guys.

  • What are you using to do bulk insert?

    what is the error message?

    Please post any code or messages that you think may help

  • These are the error on the server that is doing the bulk insert.

     

    Server: Msg 4861, Level 16, State 1, Line 2

          Could not bulk insert because file '\\PVMX0720\IdentityExporter\Meta\Bulk\Meta.txt' could not be opened. Operating    system error code 5(Access is denied.).

     

          Server: Msg 4861, Level 16, State 1, Line 3

          Could not bulk insert because file '\\PVMX0720\IdentityExporter\Meta\Bulk\Cid.txt' could not be opened. Operating    system error code 5(Access is denied.).

     

          Server: Msg 4861, Level 16, State 1, Line 3

          Could not bulk insert because file '\\PVMX0720\IdentityExporter\Emac\Bulk\Emac.fmt' could not be opened. Operating    system error code 5(Access is denied.).

     

          Server: Msg 4861, Level 16, State 1, Line 3

          Could not bulk insert because file '\\PVMX0720\IdentityExporter\Emac\Bulk\Cid.txt' could not be opened. Operating    system error code 5(Access is denied.).

     

     

    The following are the queries used:

     

            TRUNCATE TABLE MetaIdentitiesStaging

            BULK INSERT dbo.MetaIdentitiesStaging

            FROM '\\PVMX0720\IdentityExporter\Meta\Bulk\Meta.txt'

            WITH (FIELDTERMINATOR = '|', FIRSTROW = 2)

            GO

     

  • Check if the server can access that file (ntfs permissions) and that the file path is correct. The server must be logged as a domain login to have access (most likely).

  • Which of the server? The SQL server or the sever where the application and file reside?

     

    Thanks.

  • Sql server must have access to the server where the file resides to be able to open it.

  • Hello,

    I have the same problem. Do you have found any solution ?

    Thanks in advance.

  • Yes... the solution is posted above... the server must be logged into the domain as a user that can actually "see" the file path.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Nice tip...

    Sorry about my lack of knowledge but.. How can I grant access the SQL Server to access a folder located in my HD?. I give the sats the UNC format: \\machine\folder\files.txt.

    Thanks a lot, mates.

    Dvel

  • You have to create a "share" to your directory... the share would be for the user that SQL Server logs in as... OR... if SQL Server was given super user or domain admin privs on the Windows Server, you might be able to use the generic C$ administrative share...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • I got it; thanks a lot...

Viewing 11 posts - 1 through 10 (of 10 total)

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