MSSQL in Docker - Cannot bulk load. The file "@file" does not exist or you don't have file access rights

Viewed 61

I am using Docker's MSSQL because I'm on Ubuntu 22.04.

In the terminal,

cat @filepath

where @filepath is the absolute file path, works.

So the file path exists, and I have file rights (don't need to sudo)

How can I solve this? I am not too sure about how to use docker, but when I connected to my docker's MSSQL, my server was localhost, 1433

2 Answers

You cannot access your local files from Docker. This is what you should do:

docker cp @FILEPATH @CONTAINER:/

from there,

bulk insert your_table_name
from '/';

or whatever your bulk insert statement, would work

If you are using BULK INSERT T-SQL statement to do the bulk load, then you need to make sure that the service account running the SQL Server instance has access to the file. In this case SQL Server will not be using your user account.

Related