Showing results for 
Search instead for 
Did you mean: 
Level: Powered On

Stored Procedure Issue: Incorrect syntax near the keyword 'convert'.

I am using PowerApps to execute a stored procedure via on premise gateway. I have the Stored Procedure added in Flow and when I execute the procedure, I get the following error message:


Invalid Mashup Expression using supplied values.
 inner exception: Microsoft SQL: Incorrect syntax near the keyword 'convert'.


The Stored Procedure that is being executed does not contain the word "convert" so I am not sure where the incorrect syntax would be.  I made sure the parameter type being passed into the Stored Procedure match the type of the columns being updated.  I also changed the type of the values I am passing in and still get the same error (added qoutes around values, removed quotes).

When I execute the Stored Procedure within SQL Managment Studio with the exact same values, the Stored Procedue executes successfully.  


Any ideas on how to troubleshoot this?

Level: Powered On

Re: Stored Procedure Issue: Incorrect syntax near the keyword 'convert'.

I ran a trace on the call to the stored procedure and it looks like Flow is passing in a function for a DateTime paramter rather than a DateTime.


For example, the trace shows that power apps is calling the stored procedure with the following parameters:

exec [dbo].[stpUpdateSomething] 744438, null, null, '67146', convert(datetime2, '2017-09-22 09:40:00'), null



This is causing the procedure to fail.


Here is the flow:




I tried a few different formats and Flow keeps passing a function for the parameter. 


Can someone please shed some light on why flow is doing this? And any work arounds?


Community Support Team
Community Support Team

Re: Stored Procedure Issue: Incorrect syntax near the keyword 'convert'.

Hi jonathanO,


What’s the format for the Datetime field?

Please take this documentation for a reference:

The output of datetime2 is something likes: 2007-05-08 12:35:29. 1234567.

Please try to format the datetime to a format likes above to see if it will work.


Best regards,
Mabel Mao

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

Helpful resources


Power Automate Community User Group Member Badge

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


Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!


Microsoft Learn

Learn how to build the business apps that you need.


Power Platform World Tour

Find out where you can attend!


Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 182 members 5,571 guests
Please welcome our newest community members: