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

Community site session details

Session Id : auT/D9r7VavcZRwipSvtt7
Power Automate - Building Flows
Answered

Flow failing when SQL query returns empty set

Like (0) ShareShare
ReportReport
Posted on 21 Jan 2021 19:30:56 by 17

I've created a flow that fails when the SQL query returns an empty set.  I've found lots of mentions of similar issues, but none that include a solution.
This is a very simple flow - I'm searching a database for employees with a given start date, and sending an email to each of them.  Often, though, there are no employees with a particular start date, and the flow fails.

DBean_0-1611256180145.png

 

I've tried this:

 

DBean_3-1611256817968.png

 

And that doesn't work:

DBean_4-1611256891983.png

 

I found mentions of an "Empty" function, but when I try using that instead of "Null", I get this:

DBean_2-1611256667801.png

Any thoughts?  Thanks in advance!

 

 

I have the same question (0)
  • Verified answer
    Paulie78 Profile Picture
    8,418 Moderator on 22 Jan 2021 at 00:13:06
    Re: Flow failing when SQL query returns empty set

    The SQL connector returns a bunch of outputs, I would suggest you use something like:

    not(empty(outputs('Execute_a_SQL_query_(V2)')?['body/resultsets/Table1']))

    On the left side of your condition and the true expression on the right side. Make sure you use the expression true, not just type true in, like this:

    EmptySQL.jpg

  • DBean Profile Picture
    17 on 22 Jan 2021 at 17:07:47
    Re: Flow failing when SQL query returns empty set

    @Paulie78 That did the trick - thanks!

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 666 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 382 Moderator

#3
developerAJ Profile Picture

developerAJ 254

Last 30 days Overall leaderboard
Loading complete