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

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?

2 REPLIES 2
Highlighted
Advocate II
Advocate II

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:

 

flow_storedProc.PNG

 

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?

 

Highlighted
Community Support
Community Support

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:
https://docs.microsoft.com/en-us/sql/t-sql/data-types/datetime-transact-sql


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

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

Top Solution Authors
Top Kudoed Authors
Users online (8,008)