# \[bug-15464\]Query Tags running Update statements execute but display as errored

**URL:** <https://forum.inductiveautomation.com/t/bug-15464-query-tags-running-update-statements-execute-but-display-as-errored/30007>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [November 15, 2019, 6:19pm UTC](https://forum.inductiveautomation.com/t/bug-15464-query-tags-running-update-statements-execute-but-display-as-errored/30007 "2019-11-15T18:19:49Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![AIO](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/aio/32/87549_2.png) [@AIO](https://forum.inductiveautomation.com/u/AIO)\
**Post date:** [November 15, 2019, 6:19pm UTC](https://forum.inductiveautomation.com/t/bug-15464-query-tags-running-update-statements-execute-but-display-as-errored/30007/1 "2019-11-15T18:19:49Z")

</div>

Hey folks,

Ignition 8.0.5

I have several Query Tags running update statements, and they are executing properly. However, in the tag browser they return show a red error indicator and read “Error\_ExpressionEval(“The statement did not return a result”)”.

Given that the query is executing properly, and it should not return a result, is there any way to fix this result? Previously (7.9.12) these types of tags returned a 1, and only showed an error when the query or tag failed to execute.

Query attached below, as well as tag details.

```auto
update ttc_overview
set
Blend = 'Testing Blend'
where Tank_Number = '306'

```

 ![Update%20Query](https://us1.discourse-cdn.com/inductiveautomation/original/2X/e/e685af26d0be2e66a5f3cf5ea7bf78e2943c523c.png)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [November 15, 2019, 7:38pm UTC](https://forum.inductiveautomation.com/t/bug-15464-query-tags-running-update-statements-execute-but-display-as-errored/30007/2 "2019-11-15T19:38:51Z")

</div>

Huh. It would not have occurred to me to put an UPDATE in a query tag. I suspect it didn’t occur to IA, either.

---

<div class="post-metadata">

**Author:** ![AIO](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/aio/32/87549_2.png) [@AIO](https://forum.inductiveautomation.com/u/AIO)\
**Post date:** [November 15, 2019, 7:43pm UTC](https://forum.inductiveautomation.com/t/bug-15464-query-tags-running-update-statements-execute-but-display-as-errored/30007/3 "2019-11-15T19:43:12Z")

</div>

We use them in UDTs for moving tag data into a snapshot / overview table in an easily modifiable and maintainable fashion. It started as transaction groups, but modifying 400 transaction groups is a lot more tedious than updating a UDT query definition.

If you have any recommendations for improving this, I welcome it. 🙂

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [November 15, 2019, 8:11pm UTC](https://forum.inductiveautomation.com/t/bug-15464-query-tags-running-update-statements-execute-but-display-as-errored/30007/4 "2019-11-15T20:11:37Z")

</div>

I’d script the whole lot. In v8, with a combination of tag events defined on the UDT (to note changes) and a gateway timer in the global scripting project (to send changes to the DB). I really don’t like unconditional updates to a DB.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 15, 2019, 8:23pm UTC](https://forum.inductiveautomation.com/t/bug-15464-query-tags-running-update-statements-execute-but-display-as-errored/30007/5 "2019-11-15T20:23:19Z")

</div>

While I don’t disagree with Phil about unconditional updates to the DB, this is actually supported - there’s code on the backend to attempt to determine the query type, and issue it to the db as an update/select appropriately- and there’s also a manual query type override, that we’re just not exposing in the UI - I’m not sure why.

@AIO, I can’t guarantee this will work, but if you right click the tag, select ‘Edit (raw)’, and then add a `queryType: Update` property, do you still get the error on the tag?  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/7/73f13490cbf9ad1fb33dec45f7ac78fc29c8d5a2.png)

---

<div class="post-metadata">

**Author:** ![AIO](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/aio/32/87549_2.png) [@AIO](https://forum.inductiveautomation.com/u/AIO)\
**Post date:** [November 15, 2019, 8:27pm UTC](https://forum.inductiveautomation.com/t/bug-15464-query-tags-running-update-statements-execute-but-display-as-errored/30007/6 "2019-11-15T20:27:05Z")

</div>

Paul,

That did the trick! I appreciate it.

I’ll take a look into moving the process into the gateway and what it will take to execute - always room for improving the process.

Cheers!

---

<div class="post-metadata">

**Author:** ![AIO](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/aio/32/87549_2.png) [@AIO](https://forum.inductiveautomation.com/u/AIO)\
**Post date:** [November 15, 2019, 9:22pm UTC](https://forum.inductiveautomation.com/t/bug-15464-query-tags-running-update-statements-execute-but-display-as-errored/30007/7 "2019-11-15T21:22:29Z")

</div>

Phil - if you don’t mind,

I have several identical projects in 7.9.x running the same query process, and my first search results on implementing your solution include your argument against tag events and shared scripts (in 7.9).

How would you recommend making similar changes in 7.9? Just using gateway tag change scripts?

Ideally I’d like to implement a solution that is consistent in all projects, but I realize this may not be possible.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [November 15, 2019, 10:33pm UTC](https://forum.inductiveautomation.com/t/bug-15464-query-tags-running-update-statements-execute-but-display-as-errored/30007/8 "2019-11-15T22:33:42Z")

</div>

> [@AIO](#):
>
> Just using gateway tag change scripts?

Yes, a dedicated project that had a tag change event script subscribed to all elements of all UDT instances that would be triggers for a SQL update. Same timer event to execute the SQL as needed. Not as self-maintaining as the tag events, but any prospect of editing shared scripts in v7.x are just murder on big installs.

Fortunately, the tag subscription list in a tag change event can be cut and pasted from an editor or an automated process.

---

<div class="post-metadata">

**Author:** ![AIO](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/aio/32/87549_2.png) [@AIO](https://forum.inductiveautomation.com/u/AIO)\
**Post date:** [November 15, 2019, 10:43pm UTC](https://forum.inductiveautomation.com/t/bug-15464-query-tags-running-update-statements-execute-but-display-as-errored/30007/9 "2019-11-15T22:43:48Z")

</div>

Fantastic. Thank you for the detailed reply!

---

<div class="post-metadata">

**Author:** ![Colby.Clegg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/colby.clegg/32/3282_2.png) [@Colby.Clegg](https://forum.inductiveautomation.com/u/Colby.Clegg)\
**Post date:** [January 29, 2021, 10:36pm UTC](https://forum.inductiveautomation.com/t/bug-15464-query-tags-running-update-statements-execute-but-display-as-errored/30007/10 "2021-01-29T22:36:49Z")

</div>

This is a year later, but this will be fixed for 8.1.3 (likely, PR is outstanding for that timeframe).

Also, as a work around, you can add a custom property to a tag called QueryType, type string, and set the value to “AutoDetect” or “Update”.

I know the OP worked around this issue long ago, but just in case anyone else hits this.
