I want to upload the contents of a CSV file as new values in Exact Online data set using for instance the following SQL statement:
update exactonlinerest..ItemWarehouses
set maximumstock=0
where id='06071a98-7c74-4c26-9dbe-1d422f533246'
and maximumstock != 0
I can retrieve the contents of the file using:
select *
from files('C:\path\SQLScripts', '*.csv', true)@os fle
join read_file_text(fle.file_path)@os
But seem unable to change the multi-line text in the file_contents
field to separate lines or records.
How can I split the file_contents
's field into multi lines (for instance using 'update ...' || VALUE
and then running it through @@mydump.sql
or directly using insert into / update
statement)?
For now I've been able to solve it using regular expressions and then loading generated SQL statement into the SQL engine as follows:
However, it is error prone when I have a single quote in the article code.