# SQL query from DB tag not functional

**URL:** <https://forum.inductiveautomation.com/t/sql-query-from-db-tag-not-functional/2590>\
**Category:** Ignition\
**Created:** [January 31, 2011, 5:33pm UTC](https://forum.inductiveautomation.com/t/sql-query-from-db-tag-not-functional/2590 "2011-01-31T17:33:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![PenCapBlue](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@PenCapBlue](https://forum.inductiveautomation.com/u/PenCapBlue)\
**Post date:** [January 31, 2011, 5:33pm UTC](https://forum.inductiveautomation.com/t/sql-query-from-db-tag-not-functional/2590/1 "2011-01-31T17:33:43Z")

</div>

The attached picture describes my problem.

I am using the DB query browser, and receive a row with the value 161. I use the same query on a DB tag, and receive the value null, as displayed in the tag browser.

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/1X/04bd92e1731b7d8d97c26ac7d4da7bfd0b9274e4.PNG)

---

<div class="post-metadata">

**Author:** ![PenCapBlue](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@PenCapBlue](https://forum.inductiveautomation.com/u/PenCapBlue)\
**Post date:** [January 31, 2011, 5:38pm UTC](https://forum.inductiveautomation.com/t/sql-query-from-db-tag-not-functional/2590/2 "2011-01-31T17:38:07Z")

</div>

Interestingly enough, if I make a client tag with the same query, it returns the correct value.

---

<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 31, 2011, 6:25pm UTC](https://forum.inductiveautomation.com/t/sql-query-from-db-tag-not-functional/2590/3 "2011-01-31T18:25:21Z")

</div>

Do you have a datasource specified for the SQLTags provider?

1. Log into the gateway
2. Go to SQLTags\>Realtime
3. Click “Edit” next to “default”
4. Set the default datasource.

If it’s already set, you’ll have to take a look at the logs to see what kind of error is occurring (or, if using 7.2, right click on the tag and click “tag diagnostics”)

Regards,

---

<div class="post-metadata">

**Author:** ![PenCapBlue](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@PenCapBlue](https://forum.inductiveautomation.com/u/PenCapBlue)\
**Post date:** [January 31, 2011, 6:47pm UTC](https://forum.inductiveautomation.com/t/sql-query-from-db-tag-not-functional/2590/4 "2011-01-31T18:47:57Z")

</div>

Beautiful, thank you very much.
