How do I add an image to Azure SQL Database?

I’ve been rewriting my database recently and wanted it to be able to accept images. However in case of Azure it’s a lot more tricky, since adding images directly from PC is impossible and ends up with this error:

INSERT INTO [Lesson_Content] (Lesson_Language, Lesson_Text, Id_Lesson, Lesson_Image) SELECT 'Polish','sample text', 4, BulkColumn
FROM OPENROWSET
(
    Bulk 'C:\Users\ogryz\Desktop\swedish.png', SINGLE_BLOB
)AS Lesson_Image

Cannot bulk load because the file “C:\Users\ogryz\Desktop\swedish.png” could not be opened. Operating system error code 997(Overlapped I/O operation is in progress.).

So I had to resort to storage blobs, however I have no clue how to add an image to them via SQL rather than throught website.

So, I’d actually have two questions:

  1. How to add an image to blob storage throught sql?
  2. Is there some better method of adding an image to Azure SQL Database rather than using previously mentioned blobs?

Read more here: Source link