# Compara null from query

**URL:** <https://forum.inductiveautomation.com/t/compara-null-from-query/39570>\
**Category:** Ignition\
**Created:** [October 10, 2020, 9:11pm UTC](https://forum.inductiveautomation.com/t/compara-null-from-query/39570 "2020-10-10T21:11:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![etlikmilos](https://avatars.discourse-cdn.com/v4/letter/e/fbc32d/32.png) [@etlikmilos](https://forum.inductiveautomation.com/u/etlikmilos)\
**Post date:** [October 10, 2020, 9:11pm UTC](https://forum.inductiveautomation.com/t/compara-null-from-query/39570/1 "2020-10-10T21:11:50Z")

</div>

Hi all i have question again about compare but now is from null value. I have query to SQL and I compare returns value but if is still true :(. How I can compare this null values ?

```auto
testBarCode = system.db.runPrepQuery("SELECT barCode FROM maintenanceWarehouse WHERE barCode = ?",[barCode],"Technici")
if testBarCode is not None:
	...........................
	

```

And I tried this but it is same

```auto
testBarCodeDataSet.getValueAt(0,0)

```

Thank you 😃

---

<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:** [October 11, 2020, 12:39am UTC](https://forum.inductiveautomation.com/t/compara-null-from-query/39570/2 "2020-10-11T00:39:11Z")

</div>

Running the query like that will always return a dataset, but it might have zero rows. Check for .rowCount\>0 first, or consider using .runScalarPrepQuery().

---

<div class="post-metadata">

**Author:** ![etlikmilos](https://avatars.discourse-cdn.com/v4/letter/e/fbc32d/32.png) [@etlikmilos](https://forum.inductiveautomation.com/u/etlikmilos)\
**Post date:** [October 11, 2020, 12:14pm UTC](https://forum.inductiveautomation.com/t/compara-null-from-query/39570/3 "2020-10-11T12:14:55Z")

</div>

Thank you so much I used compare rowCount and it is OK: D I forget that runQuery return always data: D: D Thanks
