# Passing nulls to Named Query when testing

**URL:** <https://forum.inductiveautomation.com/t/passing-nulls-to-named-query-when-testing/42907>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [February 2, 2021, 7:26pm UTC](https://forum.inductiveautomation.com/t/passing-nulls-to-named-query-when-testing/42907 "2021-02-02T19:26:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [February 2, 2021, 7:26pm UTC](https://forum.inductiveautomation.com/t/passing-nulls-to-named-query-when-testing/42907/1 "2021-02-02T19:26:46Z")

</div>

I have an SQL table which has nullable numerical fields (and none of the fields have default values) , and I want to use a Named Query to update it. Basically a simple:

```auto
UPDATE TableName
SET
FieldName1 = :FieldValue1,
FieldName2 = :FieldValue1,
FieldName2 = :FieldValue1
WHERE keyField=:KeyVal

```

When testing the query from the Name Query testing panel I only filled out the parameters for the KeyVal and one of the numerical value fields. But when I browsed the table directly from the DB I saw that _all_ the numerical fields for which I did not explicitly supply a value had a value of zero.

How do I fill out parameters in a Named Query test so that null (or python None) values get correctly propagated to the DB table as nulls?

Or is this just a side effect of the testing panel?

And if I call the query with a dictionary like { ‘FieldValue1’ : None, ‘FieldValue1’ : None } etc, will that propagate the null values?

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [February 2, 2021, 7:41pm UTC](https://forum.inductiveautomation.com/t/passing-nulls-to-named-query-when-testing/42907/2 "2021-02-02T19:41:16Z")

</div>

Answering my own question. The setting of numerical values to zero seems to be an artifact of the Named Query testing panel. When I called the query via [system.db.runNamedQuery](https://docs.inductiveautomation.com/display/DOC80/system.db.runNamedQuery) and only provided some of the parameters, the rest of the numerical fields ended up with nulls.

---

<div class="post-metadata">

**Author:** ![tmahaf](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tmahaf/32/23492_2.png) [@tmahaf](https://forum.inductiveautomation.com/u/tmahaf)\
**Post date:** [April 25, 2022, 5:15pm UTC](https://forum.inductiveautomation.com/t/passing-nulls-to-named-query-when-testing/42907/3 "2022-04-25T17:15:51Z")

</div>

I’m not aware of setting a value to null under the testing panel, it seems like it wants to do 0 for an integer if you clear it, which would not be the same as null.

Does anyone have any good suggestions?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/9/994bcd8ca8fb36a301469180532c9f1baca7dcf9.png)

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [April 25, 2022, 7:52pm UTC](https://forum.inductiveautomation.com/t/passing-nulls-to-named-query-when-testing/42907/4 "2022-04-25T19:52:58Z")

</div>

As far as I know, the query testing tab will not allow parameters to be null. To test it, you would have to use the script console, or test it in the project. I’ve run into this as well when writing queries with parameters controlling filtering.
