0

I use SQL Server docker container for the first time. I run and connect docker without a problem.

When I try to load XML file to variable using this script:

DECLARE @xmldata XML

SELECT @xmldata=BulkColumn
FROM 
OPENROWSET (BULK 'D:\DaneXML\NBP\a051z140314.xml',SINGLE_BLOB) as T1

SELECT @xmldata as Dokument

Normally parameter was a path to file on hard drive (just for learning)

Now certainly path to my hard drive (D:\DaneXML\NBP\a051z140314.xml) is not recognised, because I am 'inside' the container.

What should I do to load this file then?

Probably I have to add the file to the container, how should I do it?

And what would be a PATH to use in OPENROWSET()?

And please, remember that this is my first time with docker containers :)

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Janek Podwysocki
  • 543
  • 1
  • 6
  • 18
  • With your container running, you can get in there and explore it using [docker exec](https://docs.docker.com/engine/reference/commandline/exec/). So you would run the container, then run something like `docker exec -it powershell`. – bluescores Feb 01 '18 at 20:05
  • it is not anwser to my question :) – Janek Podwysocki Feb 01 '18 at 20:28

1 Answers1

1

As this answer explain: How to copy files from host to Docker container?

You could use a command like:

docker cp "[YOURFILEPATH]" [CoontainerName]:/var/opt/mssql/data/[FileNameOnDestiny]

Ex: docker cp "D:\docs\Ohglab\Tyseg\Ejecución\backup producción\AlcofingerDB.bak"sqlserver1:/var/opt/mssql/data/AlcofingerDB.bak

Then you could use that file:

enter image description here