Mac Docker Bulk Insert Into MS-SQL Server

Viewed 50

On my Mac I’ve installed an instance of MS-SQL server in a Docker container. I’m able to connect to it using Azure Data Studio and can create tables, write queries, etc. without any problem. I’m now trying seed a table doing a bulk insert from an external csv file. I’ve copied the files to the Docker container as described in this post: Link

When I try to run the bulk insert, I get the following error:

Cannot bulk load because the file "/CountryErrors.txt" could not be opened. Operating system error code 5(Access is denied.)

I’m not very familiar with Linux and the CLI, but I’m guessing the permissions are incorrect. I’m not sure how to or what to change them to?

-rw-r--r--   1  501 dialout         0 Jul 18 23:51 CountryErrors.txt
-rw-rw-r--   1  501 dialout       478 Sep  7  2019 CountryFormat.fmt
-rw-rw-rw-   1  501 dialout     11816 Sep  7  2019 CountrySeed.csv

Relevant SQL code:

BULK INSERT [dbo].[#CountryTEMP]
    FROM '/CountrySeed.csv'
    WITH
    (
    FIRSTROW = 2,
    FORMATFILE = '/CountryFormat.fmt',
    ERRORFILE = '/CountryErrors.txt'
    )
0 Answers
Related