You are viewing limited content. For full access, please sign in.

Question

Question

Help with Workflow Custom Query to Microsoft SQL database

asked on March 14, 2016

Hi Everyone,

I am having issues with the Custom Query activity in Workflow using parameters. We are using Microsoft SQL Express. 

When I hard code the value of the field I am querying without parameters, there is no issue and the Rows affected are displayed when testing (see attachment). Also the Query Data activity works a treat, but I will need some more advanced searches.

But when I add the Parameter to test a basic query, the following error is returned - "Incorrect syntax error near '?'.

Is there something I am missing?

 

cheers

Grant

 

Test Custom Query Syntax working without Paramaters.png
Test Custom Query Syntax error with Paramaters.png
0 0

Answer

SELECTED ANSWER
replied on March 15, 2016

Hi Grant, 

I found the issue, go to your Data Source and edit the Data Source type to ODBC with Sql. I got the same error as you since i used Sql (Direct), but this change has worked for me. 

 

1 0

Replies

replied on March 15, 2016

Hi Darren/Gert,

Still no luck. 

Darren - I did test your suggestion, it appears you need to enter the Column Name in replace of the ? symbol. Selecting the Test option, the query did not error, however it did return all records from the database, not the specified record, I used (Operations).

 

Gert - See my screen shots slightly modifying my query to match your suggestion, but the exact same syntax error is still produced using the Test.  

 

cheers

Grant

SQL DB.png
Test Custom Query Syntax error with Paramaters1.png
SQL DB.png (16.5 KB)
1 0
replied on March 14, 2016

Hi Grant,

 

Try adding WHERE Department LIKE = ?

0 0
replied on March 14, 2016

Hi Gert,

 

I have just tried your suggestion, but still no luck.

 

incorrect syntax error.JPG
0 0
replied on March 15, 2016

Hi Grant, 

 

Can you send me a screenshot of the DB Name, Table and the column

 

My Delete queries would look like this (Taking yours as an example)

 

What value does your ForEachRow3_Department return?

 

 

 

Thanks

0 0
replied on March 15, 2016

Hi Grant,

Could you try changing the Parameter Name to something other than ?.  Here's an example that works for me. 

 

 

0 0
replied on March 15, 2016

Great Gert, that worked a treat! Your help is very much appreciated! wink

 

cheers

Grant

 

0 0
replied on July 26, 2016 Show version history

Guys,

I am getting similar error when trying to run a query for Documents Creation Date.

The query works fine in SQL Management studio, but doens't work in WOrkflow.

 

 

When I Test this query from WF, by passing values '2013-04-6' I get the error.

Error:

 

 

When I tried passing the values directly in the query (like below) :

I get this error:

You are not allowed to follow up in this post.

Sign in to reply to this post.