# Named Query Params Error

**URL:** <https://forum.inductiveautomation.com/t/named-query-params-error/62793>\
**Category:** Ignition\
**Tags:** namedqueries, perspective\
**Created:** [August 8, 2022, 7:02pm UTC](https://forum.inductiveautomation.com/t/named-query-params-error/62793 "2022-08-08T19:02:42Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raymond\_Sipes](https://avatars.discourse-cdn.com/v4/letter/r/4491bb/32.png) [@Raymond\_Sipes](https://forum.inductiveautomation.com/u/Raymond_Sipes)\
**Post date:** [August 8, 2022, 7:02pm UTC](https://forum.inductiveautomation.com/t/named-query-params-error/62793/1 "2022-08-08T19:02:42Z")

</div>

Hello!

I have a named query that looks for parameters and passes the value to the named query. This is my query below.

```auto
UPDATE Fake
SET WorkOrder_ID = :WOID, Good_Part_Count = :GPC, Total_Part_Count = :TPC, WO_Status = 'S', Finish_Time = getdate()
WHERE WorkOrder_ID = :WOID

```

My parameter types are value, and the WOID data type is a string while the GDC and TPC is Float4.

The error code I get is this,

> File "function:runAction", line 2, in runAction  
> java.lang.Exception: java.lang.Exception: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near ':'.

I assume I am missing something that is rather simple, but cannot get it figured out as to what it is.

Thanks!

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [August 8, 2022, 7:16pm UTC](https://forum.inductiveautomation.com/t/named-query-params-error/62793/2 "2022-08-08T19:16:44Z")

</div>

You haven’t provided the script that is running this query. That may provide more insight into what is wrong.

---

<div class="post-metadata">

**Author:** ![Raymond\_Sipes](https://avatars.discourse-cdn.com/v4/letter/r/4491bb/32.png) [@Raymond\_Sipes](https://forum.inductiveautomation.com/u/Raymond_Sipes)\
**Post date:** [August 8, 2022, 7:20pm UTC](https://forum.inductiveautomation.com/t/named-query-params-error/62793/3 "2022-08-08T19:20:20Z")

</div>

My apologies, this is the script.

```auto
	system.db.runNamedQuery('Fake_Name', 'Pasting Submit', {"WOID": str(self.getSibling("Label_0").props.text), "TPC": (self.getSibling("Label_20").props.text), "GPC": (self.getSibling("NumericEntryField").props.value)})

```

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [August 8, 2022, 7:24pm UTC](https://forum.inductiveautomation.com/t/named-query-params-error/62793/4 "2022-08-08T19:24:57Z")

</div>

What is the value of `self.getSibling('Label_0').props.text)` and `self.getSibling('Label_20').props.text`?

For instance if you add this line before you call the named query what do you see in the console?

```auto
system.perspective.print(self.getSibling('Label_0').props.text)

```

---

<div class="post-metadata">

**Author:** ![Raymond\_Sipes](https://avatars.discourse-cdn.com/v4/letter/r/4491bb/32.png) [@Raymond\_Sipes](https://forum.inductiveautomation.com/u/Raymond_Sipes)\
**Post date:** [August 8, 2022, 7:31pm UTC](https://forum.inductiveautomation.com/t/named-query-params-error/62793/5 "2022-08-08T19:31:58Z")

</div>

I did add that before the named query, It does bring in the Label\_0 value, as well as the Label\_20 value. It does give a lot more information related to the error code.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [August 8, 2022, 7:35pm UTC](https://forum.inductiveautomation.com/t/named-query-params-error/62793/6 "2022-08-08T19:35:40Z")

</div>

What are those values?

As you have correctly set the parameters dictionary in the `runNamedQuery` function, it suggests that the ‘:’ mentioned in the error is being sent as a value of one of the parameters.

There isn’t really anything else it can be, assuming that everything is as you have shown in the query and script.

---

<div class="post-metadata">

**Author:** ![Raymond\_Sipes](https://avatars.discourse-cdn.com/v4/letter/r/4491bb/32.png) [@Raymond\_Sipes](https://forum.inductiveautomation.com/u/Raymond_Sipes)\
**Post date:** [August 8, 2022, 7:40pm UTC](https://forum.inductiveautomation.com/t/named-query-params-error/62793/7 "2022-08-08T19:40:00Z")

</div>

That is what confuses me, this query is basically the same as another one I have just without a column. The values are `Label_0` = MFG0208870 and the `Label_20` Is 100. I may have to get in touch with Ignition and see if they have any solutions as this has been bugging me all day lol.

---

<div class="post-metadata">

**Author:** ![Samg23](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@Samg23](https://forum.inductiveautomation.com/u/Samg23)\
**Post date:** [August 8, 2022, 7:50pm UTC](https://forum.inductiveautomation.com/t/named-query-params-error/62793/8 "2022-08-08T19:50:43Z")

</div>

My guess with that error would be that the parameter is misspelled somewhere in your named query as lrose mentioned, here’s an example.

 ![queryerror](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/e/6ebc8865c250042a6b3cb63aad1ac284fe77c630.png)

---

<div class="post-metadata">

**Author:** ![Raymond\_Sipes](https://avatars.discourse-cdn.com/v4/letter/r/4491bb/32.png) [@Raymond\_Sipes](https://forum.inductiveautomation.com/u/Raymond_Sipes)\
**Post date:** [August 8, 2022, 7:53pm UTC](https://forum.inductiveautomation.com/t/named-query-params-error/62793/9 "2022-08-08T19:53:53Z")

</div>

Gosh, I am almost ashamed to admit that was the error. Thank you for troubleshooting and finding the solution! Might need to take a break, been staring at the screen for too long lol.

---

<div class="post-metadata">

**Author:** ![Samg23](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@Samg23](https://forum.inductiveautomation.com/u/Samg23)\
**Post date:** [August 8, 2022, 7:56pm UTC](https://forum.inductiveautomation.com/t/named-query-params-error/62793/10 "2022-08-08T19:56:40Z")

</div>

Haha no worries, the query editor is where most of my headaches come from as it isn’t the best at telling you what the exact issue is like in this case.

---

<div class="post-metadata">

**Author:** ![Raymond\_Sipes](https://avatars.discourse-cdn.com/v4/letter/r/4491bb/32.png) [@Raymond\_Sipes](https://forum.inductiveautomation.com/u/Raymond_Sipes)\
**Post date:** [August 8, 2022, 7:57pm UTC](https://forum.inductiveautomation.com/t/named-query-params-error/62793/11 "2022-08-08T19:57:32Z")

</div>

I completely agree! Have a great rest of your day and thanks again!

---

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [September 23, 2022, 1:18am UTC](https://forum.inductiveautomation.com/t/named-query-params-error/62793/12 "2022-09-23T01:18:26Z")

</div>

I found that if you have an incorrect data type, say Int4 when it wants an Int8.

MSSQL data type integer, using numbers with six or less digits, I thought Int4 was correct, however I got the same syntax error, but upon changing it to Int8, no error and the query functioned as expected.
