cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BegeNCSU
Advocate II
Advocate II

Stored Procedure returning empty result set

I've been trying to follow along with the blog post and video on how to return an array from SQL and I'm not able to get a resultset from the stored procedure from an on-premise SQL gateway. My ultimate goal is to be able to pass parameters to the stored procedure, but I'm stuck on just getting any kind of result with hardcoded parameters.

Stored Procedure:

ALTER PROCEDURE [dbo].[uspSelectedParticipants]

    @Program Varchar(max)='''Tracking Out'', ''After School''',
	@Branch varchar(max)='''YT Testing''',
	@SITE varchar(max)='''YT-Green Elementary'''
AS
BEGIN

    SET NOCOUNT ON;

    Declare @SQL Varchar(max)
    Set @Sql = 'SELECT MASTER_CUSTOMER_ID, firstname FROM PA_Current_Participants_VW
where BRANCH_NAME= '+@BRANCH+' AND SITE_LOCATION= '+@SITE+' AND PROGRAM_TYPE IN (' + @Program + ')'

    Exec (@SQL)
END


GO

I created a flow that runs off a button and while it runs successfully, I get this in the Outputs:

{
  "OutputParameters": {},
  "ResultSets": {}
}

What am I missing here?

5 REPLIES 5
v-bacao-msft
Community Support
Community Support

Hi @BegeNCSU ,

 

MS Flow cannot return OUTPUT parameters from a stored procedure, please check Known issues and limitations:

https://docs.microsoft.com/en-us/connectors/sql/#known-issues-and-limitations

 

Best Regards,

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

Thanks for the quick reponse! 
In the link you sent, under item 3 it states 

  • Only the first result set is returned

That makes me think that I can return at least 1 results set. Am I reading that correctly?

Hi @v-bacao-msft , 

Thanks for your response. It was a big help yesterday when i followed your link and learned about the limitations of the on-premise sql connector. However, when I revisit that same page today, that entire "known-issues-and-limitations" is gone!!  

 

May i know if these limitations are being taken care of? especially the one where it says "When invoking a stored procedure from an on-premise SQL server, return value is not available."

 

Thank you for your help! 

BegeNCSU
Advocate II
Advocate II

I will say that I've been able to run stored procedures and get the results back into my flow so long as it was just a single table. Once you're able to get to the part where you can successfully kick off the stored procedure, you'll need to parse just a specific part of the output into JSON.

Thanks! I have it working today. Not sure why no value return when i first tested it. 

Helpful resources

Top Solution Authors
Users online (3,817)