# UPDATE query of Popup Calendar

**URL:** <https://forum.inductiveautomation.com/t/update-query-of-popup-calendar/18412>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [June 12, 2018, 12:11am UTC](https://forum.inductiveautomation.com/t/update-query-of-popup-calendar/18412 "2018-06-12T00:11:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stuart](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@Stuart](https://forum.inductiveautomation.com/u/Stuart)\
**Post date:** [June 12, 2018, 12:11am UTC](https://forum.inductiveautomation.com/t/update-query-of-popup-calendar/18412/1 "2018-06-12T00:11:24Z")

</div>

I have a popup calander with the **Date** property set to a **SQL Query**. This is the **SELECT Query**. Works great.

```auto
SELECT taskStartDate
FROM task
WHERE pmkTask = '{Task.pmkTask}'

```

It is also set to use the **UPDATE Query** :

```auto
UPDATE task
SET taskStartDate = '{this}'
WHERE pmkTask = '{Task.pmkTask}'

```

Which does not work. It gives me the following error.

```auto
GatewayException: SQL error for "UPDATE task
SET taskStartDate = '06/26/2018 12:01 AM'
WHERE pmkTask = '29'": Data truncation: Incorrect datetime value: '06/26/2018 12:01 AM' for column 'taskStartDate' at row 1
	caused by MysqlDataTruncation: Data truncation: Incorrect datetime value: '06/26/2018 12:01 AM' for column 'taskStartDate' at row 1

Ignition v7.9.8 (b2018053113)
Java: Oracle Corporation 1.8.0_172

```

Obviously there is some sort of formatting problem, but I’m not sure the best way to fix it.

Any suggestions?

**EDIT:** Found the problem. Part of it was my fault, and the other part is either a bug or a feature. That error message I posted above is what happens when you try to use the formatted date, rather than `{this}`.

The above code works fine as long as there is data in the database. If the value coming from the database is `NULL` then the update query doesn’t seem to work.

Is this intentional?

---

<div class="post-metadata">

**Author:** ![Stuart](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@Stuart](https://forum.inductiveautomation.com/u/Stuart)\
**Post date:** [June 12, 2018, 4:57pm UTC](https://forum.inductiveautomation.com/t/update-query-of-popup-calendar/18412/2 "2018-06-12T16:57:38Z")

</div>

After working with this more… It seems there is an error if the template in the designer has no value. Even if the client has a value, it will error out because the template, initially, is blank.
