Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

Running SQL Stored Procedure through PowerApps

(0) ShareShare
ReportReport
Posted on by 6

Hello,

 

I am quite new to the flow (in short knows nothing) and I am creating a flow for the first time and needs help!

 

I have created a PowerApp and I need to run a On Premise SQL Server Stored Procedure which requires an input. That input I intend to provide through using a text box input. 

 

In this scenario, the stored procedure will create a table for the direct and indirect reporting employees of a given employee ID. This ID is an input field/text field in PowerApps. I am doing following steps:

 

  1. I chose PowerApps as a connector
  2. Under Action, I chose SQL Server and then execute Stored proceduresFlow Help.PNG

    3. I do not know what to put under "plnitld". In case if I am skipping the step, I am getting the error:

{
"status": 400,
"message": "Table does not contain column: 'pInitId'. Valid fields are: 'inp'.\r\n inner exception: Table does not contain column: 'pInitId'. Valid fields are: 'inp'.\r\nclientRequestId: 0ec623d8-f293-4220-8fdb-2b0cafe875be",
"source": "sql-wus.azconn-wus.p.azurewebsites.net"
}
 
This is quite crucial for me as this will depend on the success of the app I have created.
 
Any help/guidance will be highly appreciated.
 
Thanks,
Vivek
  • VidyaSagarAlti1 Profile Picture
    4 on at
    Re: Running SQL Stored Procedure through PowerApps

    @IM,I have  also observed this behavior in executing a SQL stored procedure from Power Automate using the step "Execute stored procedure". It has shown extra parameter pInitId which is not part of my stored procedure. Please see image attached. My stored procedure has only a single input parameter  JSONData but no idea how the second parameter pInitId appeared in the Flow canvas.

    StoredProcIssue.JPG

     I solved the issue by simply using the latest version "Execute stored procedure(V2).Solution.JPG

     

  • RobThrive Profile Picture
    53 on at
    Re: Running SQL Stored Procedure through PowerApps

    This has been an issue ever since I created my first flow/automate about 2 months ago. I find I can sometimes make it go away by deleting the action and re-creating it. But it is really frustrating and very buggy process.

     

    It does sometimes feel like Microsoft spent so much effort renaming from Flow to Automate, that development and bug fixing of this stuff just went out the window.

     

  • jbowen Profile Picture
    10 on at
    Re: Running SQL Stored Procedure through PowerApps

    I am experiencing the same issue.  Flow is adding a parameter 'pInitId' to the input parameters when the stored procedure is selected.  I wrote the stored procedure myself minutes before adding it to the flow, so I know the parameter was never a part of the stored procedure.

     

  • BusyIntelligence Profile Picture
    312 on at
    Re: Running SQL Stored Procedure through PowerApps

    Hi Vivek, maybe the paramter plnitId was part if the stored procedure beforehand.

    I have an issue with a stored procedure that was changed months ago. One of the parameters was no longer asked as Input as it was no longer needed.

    Somehow Flow is still not aware of this change and forces me to supply a value when executing the stored procedure.

    Even when I add this as a step to a complete new flow, somewhere in the big memory of Flow it still thinks that parameter should be supplied when running that stored procedure.

    As it is no longer used, I just fill it with something meaningless (a dot or a zero), as long as the type is okay.

     

  • imvivran Profile Picture
    6 on at
    Re: Running SQL Stored Procedure through PowerApps

    @yashag2255 

     

    Thank you for your response.

     

    Following is the stored procedure I am trying to run:

     

    Drop table dtSupTbl;
     
    WITH Employee_CTE(employeenumber,displayname,supervisorId) AS 
    ( 
     SELECT employeenumber,displayname,supervisorId from [EmployeeQuaterlyReview].[dbo].[dtEmpMaster] where supervisorId=@inp
     UNION ALL 
     SELECT e.employeenumber,e.displayname,e.supervisorId 
     from [EmployeeQuaterlyReview].[dbo].[dtEmpMaster] e 
     INNER JOIN Employee_CTE c ON e.supervisorId = c.employeenumber 
    ) 
    SELECT *
    into [dbo].[dtSupTbl]
     FROM Employee_CTE

    In this @inp is the input provided through PowerApps.

     

    I am not aware of what pInitId means. This is the first time I am dealing with Flows and Stored Procedure and I have very limited knowledge in this subject.

     

    Thanks,

    Vivek

  • yashag2255 Profile Picture
    24,584 Super User 2024 Season 1 on at
    Re: Running SQL Stored Procedure through PowerApps

    Hey @imvivran 

     

    This is an inner exception that is getting thrown when the flow is trying to make a request to the stored procedure. As per the config here, your stored procedure requires a pInitId. If you think, this should not be passed as the required field, you need to make changes to the sql stored procedure and add the action for Stored Procedure in flow again.
     
    Hope this Helps!
     
    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!

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1