cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
10101
Frequent Visitor

BULK INSERT error SQL

I need to import an CSV File into SQL.

The following BULK sql query works fine in ssms.

It always fails when I try to run it in Power Automate.

Power automate creates my "bildlitste" table and my other sql code works fine in power automate.

 

Only the BULK INSERT gets me an error. Rest of sql code works fine

 

Here is my sql code:

 

BULK INSERT bildliste
FROM 'C:\Users\Administrator\Downloads\bilderliste.csv'
WITH
(
   FIRSTROW = 2, -- as 1st one is header
   FIELDTERMINATOR = ',', --CSV field delimiter
   ROWTERMINATOR = '\n', --Use to shift the control to next row
    TABLOCK
)

 

Error:

Error in SQL statement Cannot bulk load becaue the file "C:\Users\Administrator\Downloads\bilderliste.csv" could not be opened. Operating system error12232132321213123123132312213.JPG

 

Thank you for your help!

1 ACCEPTED SOLUTION

Accepted Solutions
VJR
Super User
Super User

Hi @10101 

 

I'm not sure but can you try removing the comments from the query just in case it is not interpreting them properly (eg; -- as 1st one is header).

 

Also if you can do some web search on the error message that can give you some direction.

https://stackoverflow.com/questions/19491812/cannot-bulk-load-because-the-file-could-not-be-opened-o...

 

https://sqlbak.com/blog/cannot-bulk-load-because-the-file-could-not-be-opened-operating-system-error...

 

https://stackoverflow.com/questions/14555262/cannot-bulk-load-operating-system-error-code-5-access-i...

 

 

View solution in original post

2 REPLIES 2
VJR
Super User
Super User

Hi @10101 

 

I'm not sure but can you try removing the comments from the query just in case it is not interpreting them properly (eg; -- as 1st one is header).

 

Also if you can do some web search on the error message that can give you some direction.

https://stackoverflow.com/questions/19491812/cannot-bulk-load-because-the-file-could-not-be-opened-o...

 

https://sqlbak.com/blog/cannot-bulk-load-because-the-file-could-not-be-opened-operating-system-error...

 

https://stackoverflow.com/questions/14555262/cannot-bulk-load-operating-system-error-code-5-access-i...

 

 

takolota
Super User
Super User

Anyone having trouble with this can also try this batch SQL CRUD template:

https://powerusers.microsoft.com/t5/Power-Automate-Cookbook/SQL-Batch-Create-Read-Update-and-Delete/...

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events happening this month - don't miss out!

 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Top Solution Authors
Users online (4,041)