# Named Query Not Working Correctly In Scripts

**URL:** <https://forum.inductiveautomation.com/t/named-query-not-working-correctly-in-scripts/43182>\
**Category:** Ignition\
**Tags:** ignition80, scripting\
**Created:** [February 9, 2021, 3:37pm UTC](https://forum.inductiveautomation.com/t/named-query-not-working-correctly-in-scripts/43182 "2021-02-09T15:37:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MikeAllgood](https://avatars.discourse-cdn.com/v4/letter/m/a183cd/32.png) [@MikeAllgood](https://forum.inductiveautomation.com/u/MikeAllgood)\
**Post date:** [February 9, 2021, 3:37pm UTC](https://forum.inductiveautomation.com/t/named-query-not-working-correctly-in-scripts/43182/1 "2021-02-09T15:37:28Z")

</div>

I have a very simple NQ that takes a string value as a parameter.

```auto
SELECT [bin_id]
	FROM [dbo].[case_traveler]
	WHERE [case_trav_GUID] = :case_trav_GUID 

```

In the Named Query Editor’s Testing tab, this query works as expected.  
When I execute this from a script in a Prospective View or in the Script Console, it does not return any data using the same input parameter value.

I found this, [Project Named Query Issues](http://forum.inductiveautomation.com/t/bug-12521-project-named-query-issues/22229), which was apparently a bug that was fixed 2 years ago. I’m currently using v8.0.16.

As I’ve never run into a NQ that worked in the editor but not from a script, I’m a bit perplexed. I’ve validated there are no non-printable characters in string being passed in. I’ve tested this as a simple Query and as a Scalar Query with no change in results.

I’m hoping for an idea on direction to take to correct this.  
Thanks!

---

<div class="post-metadata">

**Author:** ![MikeAllgood](https://avatars.discourse-cdn.com/v4/letter/m/a183cd/32.png) [@MikeAllgood](https://forum.inductiveautomation.com/u/MikeAllgood)\
**Post date:** [February 9, 2021, 4:04pm UTC](https://forum.inductiveautomation.com/t/named-query-not-working-correctly-in-scripts/43182/2 "2021-02-09T16:04:27Z")

</div>

Found the issue once I was able to get a second set of eyes on my fubar!
