0
votes

I am currently using Azure Logic App, Blob storage and stored procedure in Azure SQL. I am trying to upload a csv present in container in Blob storage to SQL Azure using steps in Logic Apps. Currently the stored procedure has hard coded name of CSV file present in Blob storage and the stored procedure uses Bulk Insert SQL command. All this is working fine.

I now need to generalize my Stored procedure, so that when Logic App runs it should look at the Blob storage and pick the whatever file name is there (it is guaranteed to have CSV extension) and pass it as a parameter to Stored Procedure for bulk insert of data present in CSV to Azure SQL.

Please help.

Thanks

1

1 Answers

0
votes

You can use "List blobs" action to list all of the blobs in your container and then use "For each" action to loop them(according to the description of your question, you just have one blob in your container, the "For each" will loop only once. If more than one blob, the "For each" will loop all of them).

Af that, we can use "Get blob content" to get the blob and then we can use the content in the next steps. enter image description here

If you don't want to use "Get blob content", you can also add a "Set variable" action in your "For each" to set the path of the blob as variable for use in the next steps. enter image description here

Hope it would be helpful to your problem~