# \[Perspective\] system.db.runPrepQuery() giving error "Unknown Source"

**URL:** <https://forum.inductiveautomation.com/t/perspective-system-db-runprepquery-giving-error-unknown-source/31555>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [January 23, 2020, 2:40pm UTC](https://forum.inductiveautomation.com/t/perspective-system-db-runprepquery-giving-error-unknown-source/31555 "2020-01-23T14:40:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DerekUlee](https://avatars.discourse-cdn.com/v4/letter/d/58956e/32.png) [@DerekUlee](https://forum.inductiveautomation.com/u/DerekUlee)\
**Post date:** [January 23, 2020, 2:40pm UTC](https://forum.inductiveautomation.com/t/perspective-system-db-runprepquery-giving-error-unknown-source/31555/1 "2020-01-23T14:40:33Z")

</div>

I’m trying to run a simple prep query in a perspective transform script. My code is as follows:

2 query = “SELECT \* FROM productionmodel WHERE ItemPath = ?”  
3 data = system.db.runPrepQuery(query, [value], “Dev”)

The error I’m getting is in this image (is there a better way to get the full text of this error? I can’t copy and paste it and the full text has to stretch across 3 of my monitors for me to see it all):

 ![QueryError](https://us1.discourse-cdn.com/inductiveautomation/original/2X/b/bd1ccde895247f928bb698422cc1674b5ca86292.png)

I was able to find a thread of someone having a similar error but their issue was that they didn’t specify the data source in a gateway scoped script. I’ve specified it here and still get this error. [That thread is here.](http://forum.inductiveautomation.com/t/cryptic-error-trying-to-run-system-db-runprepquery-in-a-gateway-tag-change-script/18124)

Any help is appreciated.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [January 23, 2020, 3:19pm UTC](https://forum.inductiveautomation.com/t/perspective-system-db-runprepquery-giving-error-unknown-source/31555/2 "2020-01-23T15:19:03Z")

</div>

I’m able to generate that same error if I target a table or column which does not exist.

The first two screenshots don’t make it clear that this is in a transform, but they are indeed in a transform.

**Column** doesn’t exist:

 ![30%20AM](https://us1.discourse-cdn.com/inductiveautomation/original/2X/1/1915701bccf31cc6d35853ff242e448e3ad5cc73.png)

**Table** doesn’t exist:

 ![48%20AM](https://us1.discourse-cdn.com/inductiveautomation/original/2X/2/2d848f8fe8451cfbfe7ea5c5fe4e2ff3a7ad7f6e.png)

Valid query:

 ![10%20AM](https://us1.discourse-cdn.com/inductiveautomation/original/2X/8/83060fbc629b31846f2ad7393c15b3bc6a65700c.png)

---

<div class="post-metadata">

**Author:** ![DerekUlee](https://avatars.discourse-cdn.com/v4/letter/d/58956e/32.png) [@DerekUlee](https://forum.inductiveautomation.com/u/DerekUlee)\
**Post date:** [January 23, 2020, 3:24pm UTC](https://forum.inductiveautomation.com/t/perspective-system-db-runprepquery-giving-error-unknown-source/31555/3 "2020-01-23T15:24:59Z")

</div>

There I go overlooking the obvious for something complicated. Thanks @cmallonee
