Bulk Insert fails with The handle is invalid.

  • Hi,

    I recently ran into a problem with Bulk insert. Iam importing a .csv file from a remote machine into a table. We used Bulk Insert to do the job and everything went fine for 2 weeks or so. The domain accounts that are used are trusted. Here is the error msg that we get.

     

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

    Could not bulk insert because file '\\<Servname>\C$\file.csv' could not be opened. Operating system error code 6(The handle is invalid.).

     

    Thanks in Advance

    Sirish

  • You must have administrative privilages on \\<Servname> to read C$.

    Probably user running you instance of SQLServer is not anymore.

    Set up shared folder and access rights to it properly.

    _____________
    Code for TallyGenerator

  • All the accounts used are admin accounts.

  • This is great, I have been trying to figure out why

    select * from OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',

     'Data Source=\\remotecomputer\c$\folder;Extended Properties="Text;HDR=No;FMT=Delimited"')...testfile#txt

    or

    select * from OpenRowset('MSDASQL', 'Driver={Microsoft Text Driver (*.txt; *.csv)};

      DefaultDir=\\remotecomputer\c$\folder;','select * from

    testfile.txt')

    or

    BULK INSERT Northwind.dbo.mytest FROM '\\remotecomputer\c$\folder\testfile.txt'

    wouldn't work unless the path was local to my computer.  Imagine how dumb I felt to read this thread, look at the account my local sql server was running under, and discover I was using the local system account.  I switched to a domain admin account and things work great.

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

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