web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Checking for empty sto...
Power Automate
Answered

Checking for empty stored procedure result

(0) ShareShare
ReportReport
Posted on by

Simple enough question I couldn't find an answer to after a quick forum search: I've got a Flow running a stored procedure (successfully) in my SQL Server database with an input argument. What do I need to put into a subsequent Flow condition to check if my stored procedure executed successfully, but returned no rows (i.e. the dynamic data is empty)?

Categories:
I have the same question (0)
  • Verified answer
    v-xida-msft Profile Picture
    on at

    Hi @ajm456,

     

    Which SQL connector do you use? On-premises SQL Server or SQL Server in Cloud service?

    Further, could you please share more details about your stored procedure?

    There are some limitations when we invoke a Stored Procedure on-premise SQL Server:

    • Output value for OUTPUT parameters are not returned.
    • Return value is not available.
    • Only one result set is returned.

    I have made a test on my side and the flow works well as below:12.JPG

     The flow works successfully as below:13.JPG

     The returned result of Excute stored procedure action as below:14.JPG

     

    More details about limitations of SQL Connector, please check the following document:

    Known Issues and Limitations

     

    Best regards,

    Kris

  • ajm456 Profile Picture
    on at

    Hi Kris

     

    Thanks for your reply.

     

    SQL Server is on Cloud, and my stored procedure, a simple SELECT with a pair of parameters, runs as expected when executed just as a query outside of Flow. My Flow is as below:

    Capture.PNG

     

    As you can see, the condition field is copied from yours (I've never encountered the advanced editor syntax before) and I get the following error when running:

    Capture2.PNG

     

    I'm completely new to Flow - I've probably done something silly and shouldn't be too difficult to fix Smiley Happy

     

    Kind regards,

    Andy

  • ajm456 Profile Picture
    on at

    To continue with this...

     

    I've now got the conditional successfully checking for empty results with:

    @not(empty(body('<Action_name>')?['resultsets']?['Table 1']))

    My problem is now that I am unable to choose an action in the "If yes" and "If no" sections after the condition:

    Capture3.PNG

    Completely at a loss for what the problem here is.

     

    Kind regards,

    Andy

  • ajm456 Profile Picture
    on at

    Closing this as I have now got the entire Flow working as intended. Thank you @v-xida-msft for your help Smiley Happy

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard