cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
MS_Sol
Level: Powered On

Azure SQL Stored Procedure, row count returned

I am running a stored procedure in Flow against an Azure SQL DB.  It could return no records, or X records.  How can I get the row count in the output into an int variable?

 

ar.jpg

5 REPLIES 5
Super User
Super User

Re: Azure SQL Stored Procedure, row count returned

You can add a Get Rows step. It's optional parameters allow you to filter, query and count as needed. 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

MS_Sol
Level: Powered On

Re: Azure SQL Stored Procedure, row count returned

So that would require querying the table and redoing the query in the stored procedure to the Odata query.  No way to do this against a stored procedure?

 

If I do use get rows, its not clear to me how I get a returned row count, any tips?


@Brad_Groux wrote:

You can add a Get Rows step. It's optional parameters allow you to filter, query and count as needed. 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!


 

Super User
Super User

Re: Azure SQL Stored Procedure, row count returned

According to the SQL Connector documentation, no. Get rows says:

This operation gets rows from a table.

If this is functionality you would like to see added to Flow, please consider submitting it to the Flow Ideas page, where it can be voted on by other users, and tracked and commented on by the Flow team.

As a workaround, you could possibly use an interim SharePoint List to add rows from the stored procedure, and then count the rows from the interim list.  

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

MS_Sol
Level: Powered On

Re: Azure SQL Stored Procedure, row count returned

What about the other part of my question, can you give a little detail if I user get rows how to get a count 

v-zhos-msft
Level 10

Re: Azure SQL Stored Procedure, row count returned

Hi @MS_Sol ,

It seems you want to get the amount of the records.

You can set an array variable, then append a column value to the array.

Finally, you can use the length function to get the amount fo the records.

I have made a flow for your scenario, please check it for a reference.

Capture3.PNG

Best Regards,

Community Support Team _ Zhongys

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Users online (3,833)