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
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,590)