简体   繁体   English

如何将文件名作为参数传递给 Azure 逻辑应用程序中的存储过程

[英]How to pass filename as parameters to Stored procedure in Azure Logic Apps

I am currently using Azure Logic App, Blob storage and stored procedure in Azure SQL.我目前在 Azure SQL 中使用 Azure Logic App、Blob 存储和存储过程。 I am trying to upload a csv present in container in Blob storage to SQL Azure using steps in Logic Apps.我正在尝试使用逻辑应用程序中的步骤将 Blob 存储中容器中存在的 csv 上传到 SQL Azure。 Currently the stored procedure has hard coded name of CSV file present in Blob storage and the stored procedure uses Bulk Insert SQL command.目前,存储过程具有 Blob 存储中存在的 CSV 文件的硬编码名称,并且存储过程使用 Bulk Insert SQL 命令。 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.我现在需要概括我的存储过程,以便当 Logic App 运行时它应该查看 Blob 存储并选择那里的任何文件名(保证具有 CSV 扩展名)并将其作为参数传递给存储过程以进行批量处理将 CSV 中存在的数据插入到 Azure SQL。

Please help.请帮忙。

Thanks谢谢

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).您可以使用“ List blobs ”操作列出容器中的所有 blob,然后使用“For each”操作循环它们(根据您的问题描述,您的容器中只有一个 blob,“For each” " 将只循环一次。如果有多个 blob,"For each" 将循环所有的 blob)。

Af that, we can use " Get blob content " to get the blob and then we can use the content in the next steps.然后,我们可以使用“ 获取 blob 内容”来获取 blob,然后我们可以在接下来的步骤中使用该内容。 在此处输入图像描述

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.如果您不想使用“获取 blob 内容”,您还可以在“For each”中添加一个“设置变量”操作,以将 blob 的路径设置为变量,以便在接下来的步骤中使用。 在此处输入图像描述

Hope it would be helpful to your problem~希望对你的问题有所帮助~

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM