BCP Fails to Find File

  • Hi,

    I have the following SQL statement that returns the error shown.

    BULK INSERT dbo.tablename FROM '\\server\xxx\filename' WITH (FIELDTERMINATOR = '|', ROWTERMINATOR = '');

    Error message...

    msg 4861, Level 16, State 1, Line 1

    Cannot bulk load because the file '\\server\xxx\filename' could not be opened. Operating system error code 5(Access is denied.).

    I have added the SQL Service account as a user on the share and can see the file using that account.

    Any ideas would be greatly appreciated!

    Thanks,

    Bill

  • What credentials are you using to run the bulk insert statement? If using windows auth, please check if that windows account has access to that file. When using windows authentication, bulk inser will using the windows account to access the file, not the SQL Server process account.

  • If a SQL Server user is logged in using Windows Authentication, the user can read only the files accessible to the user account, independent of the security profile of the SQL Server process.

    When executing the BULK INSERT statement by using sqlcmd or osql, from one computer, inserting data into SQL Server on a second computer, and specifying a data_file on third computer by using a UNC path, you may receive a 4861 error.

    To resolve this error, use SQL Server Authentication and specify a SQL Server login that uses the security profile of the SQL Server process account, or configure Windows to enable security account delegation. For information about how to enable a user account to be trusted for delegation, see Windows Help.

    For more information about this and other security considerations for using BULK INSERT, see Importing Bulk Data by Using BULK INSERT or OPENROWSET(BULK...).

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

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